Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Hey guys, thought I'd start this thread as a place to ask/answer questions concerning how to port any code from the Beta 4 SDK to the Beta 5.

So to get things rolling, has anyone found the replacement for UIButtonTypeNavigationBack? I can only create the square UIBarButtonItem's now. :(
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
UIButtonTypeGlass is gone too, so I dunno what's up. There doesn't appear to be any way to mimic the same style that was added when UIButtonTypeGlass was taken out (along with the navigation button types), so...

Guess we keep looking? :mad:

I used the glass buttons pretty much exclusively too. Not that I can develop for the device right now anyway since my iPhone hasn't been able to run built and signed applications since Beta 4 came around, I dunno what's up with the codesigning.
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
UIButtonTypeGlass is gone too, so I dunno what's up. There doesn't appear to be any way to mimic the same style that was added when UIButtonTypeGlass was taken out (along with the navigation button types), so...

Guess we keep looking? :mad:

I used the glass buttons pretty much exclusively too. Not that I can develop for the device right now anyway since my iPhone hasn't been able to run built and signed applications since Beta 4 came around, I dunno what's up with the codesigning.
No kidding... :mad:

I can't figure out the codesigning either, so I've been running in the simulator for the past couple weeks. Getting pretty old. :(

Apparently there's no way to add a NavigationBack button anymore. It's added automatically when you push a new view onto a UINavigationController, then you just use the "action" and "target" properties to define any custom behavior. :(
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
That seems pretty limiting, though that wouldn't exactly be weird if their goal is to lock devs into a single UI look. At least the glass buttons can be pretty much recreated with some button background image magic

The EXC_BAD_ACCESS crap is already being discussed on the Apple Support Discussions again, like it was before for Beta 4 and for some reason marked answered.

http://discussions.apple.com/thread.jspa?threadID=1513026
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
Yep, that's exactly my problem too. I've emailed Developer Technical Support, but I'm sure you already know how "prompt" they are at response. I'll probably hear back from them about 2 weeks after WWDC comes around, and then they'll just quote the directions straight off the Program Portal.
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Yep, that's exactly my problem too. I've emailed Developer Technical Support, but I'm sure you already know how "prompt" they are at response. I'll probably hear back from them about 2 weeks after WWDC comes around, and then they'll just quote the directions straight off the Program Portal.
Yep. I got an email from them about a issue I had asked about literally *3 weeks* ago. I had completely forgotten asking. :rolleyes:

On a related note, I'm having a strange issue setting custom actions for my navigation buttons. Can you see anything wrong with the following code?

Code:
self.navigationItem.leftBarButtonItem.target = self;
[self.navigationItem.leftBarButtonItem setAction:@selector(viewBack:)];
	
NSLog(@"View loaded, target is %@", self.navigationItem.leftBarButtonItem.target);
NSLog(@"And the action is %@", self.navigationItem.leftBarButtonItem.action);

Both of the NSLog's print null for the value, no matter what I do to set it. :(
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
I believe you're supposed to use the new '-[UINavigationItem setLeftBarButtonItem:animated:]' method, as I would guess that at the moment self.navigationBar.leftBarButtonItem is null.

Like...
Code:
[self.navigationItem setLeftBarButtonItem:[UIBarButtonItem initWithTitle:@"title" style:UIBarButtonItemStyleDone target:self action:@selector(viewBack:)]];

NSLog(@"View loaded, target is %@", self.navigationItem.leftBarButtonItem.target);
NSLog(@"And the action is %@", self.navigationItem.leftBarButtonItem.action);
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
I believe you're supposed to use the new '-[UINavigationItem setLeftBarButtonItem:animated:]' method, as I would guess that at the moment self.navigationBar.leftBarButtonItem is null.

Like...
Code:
[self.navigationItem setLeftBarButtonItem:[UIBarButtonItem initWithTitle:@"title" style:UIBarButtonItemStyleDone target:self action:@selector(viewBack:)]];

NSLog(@"View loaded, target is %@", self.navigationItem.leftBarButtonItem.target);
NSLog(@"And the action is %@", self.navigationItem.leftBarButtonItem.action);
Right, but the problem is that there's no way to init a new UIBarButtonItem that is in the NavigationBack style. You just have to assume it's already placed there by the system. That's why I'm so surprised they removed the ability to create a button with that style. :confused: So while that code would put the button in the upper-left corner that would perform the right selector, it still would be a rectangular button.

And also, I got the app running on my device finally! If you want any tips to getting it to work, my AIM is senorjugador914.
 

HiRez

macrumors 603
Jan 6, 2004
6,250
2,576
Western US
I guess I'm glad I decided to wait on iPhone development, sounds like there are still a lot of growing pains. I want to see them add a lot more Objective-C APIs, too, and still holding out hope that there will be some form of Cocoa Bindings and Core Data in the future. Going backwards to writing reams of UI sync glue code, and digging into C-based, non-OO APIs, is not appealing.
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
I guess I'm glad I decided to wait on iPhone development, sounds like there are still a lot of growing pains. I want to see them add a lot more Objective-C APIs, too, and still holding out hope that there will be some form of Cocoa Bindings and Core Data in the future. Going backwards to writing reams of UI sync glue code, and digging into C-based, non-OO APIs, is not appealing.
Yea, it has been a bit frustrating. But as much as I have had to re-learn, I'm still glad I started early, regardless of whether I had to re-code things or not. I'm *extra* glad I wrote the UI code programmatically, after starting that way then eventually trying to design an interface in IB once it was released, I realized what a piss-poor choice it would be. While IB is great for designing desktop apps, it's not quite ready for the iPhone. (And maybe it never will be?)

Not to burst any bubbles, but I would be really surprised if Apple included Core Bindings/Data in the iPhone SDK. I'm re-writing an app for the iPhone that was originally a desktop app using Core Data, and I think it has been at least as easy, if not easier, to write it without CD. Gives you more control over what's going on, anyway. :)
 

lucasgladding

macrumors 6502
Feb 16, 2007
319
1
Waterloo, Ontario
I'm not surprised the back button style was removed. There are plenty of developers who would misuse the style (not you guys necessarily - no offense intended) simply because they like the look of the arrows. When used inappropriately, the general purpose of the button style is lost. If absolutely necessary, any button style could be recreated without too much effort. The extra work required to do this, however, should be enough to deter developers from abusing it.

I agree with Littleodie about Core Data and Bindings. Core Data is great, but it provides much more functionality than would be necessary for most mobile applications. The big message from Apple is that developers avoid using unnecessary resources.

UINavigationController causes interfaces to behave like linked modal dialogs, so most things can be accomplished through the viewWillAppear/viewWillDisappear/etc methods. Keeping unseen view controllers synchronized through bindings wastes resources. There are cases where synchronization is necessary, but those could be handled through KVC and KVO.

I don't necessarily agree with everything Apple has done with the SDK, but I can see some of their motivations in the changes.
 

Duke Leto

macrumors regular
Mar 17, 2008
166
0
Oh noes .. the editButton is gone. I guess I can just re-do it and make it my own.

It seems that just as I am getting used to the old beta, a new one comes up :eek:
 

lucasgladding

macrumors 6502
Feb 16, 2007
319
1
Waterloo, Ontario
Oh noes .. the editButton is gone. I guess I can just re-do it and make it my own.

It seems that just as I am getting used to the old beta, a new one comes up :eek:

You did look at the documentation before posting, right ;). editButtonItem is the new property/method name. As the classes are under construction, you should be reading the API delta document with each update. Things will settle with the final release.
 

santoshgornal

macrumors newbie
May 22, 2008
10
0
Adding button to UINavigation Controller

HI I want add abutton to UINAvigationController for header bar for navigation between two view.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.