Finding Our Way Through the iPhone Beta 5 SDK...

Discussion in 'Mac Programming' started by Littleodie914, May 7, 2008.

  1. Littleodie914 macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #1
    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. :(
     
  2. Sbrocket macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #2
    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.
     
  3. Littleodie914 thread starter macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #3
    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. :(
     
  4. Sbrocket macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #4
    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
     
  5. Littleodie914 thread starter macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #5
    Dang... This is a bummer. :( The posters in that thread are having the same problem I was having running my App on a device using the Beta 4 SDK. (And running it legally, I might add. :mad:)
     
  6. Sbrocket macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #6
    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.
     
  7. Littleodie914 thread starter macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #7
    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. :(
     
  8. Sbrocket macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #8
    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);
    
     
  9. Littleodie914 thread starter macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #9
    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.
     
  10. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #10
    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.
     
  11. Littleodie914 thread starter macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #11
    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. :)
     
  12. lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #12
    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.
     
  13. Duke Leto macrumors regular

    Joined:
    Mar 17, 2008
    #13
    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:
     
  14. lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #14
    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.
     
  15. santoshgornal macrumors newbie

    Joined:
    May 22, 2008
    #15
    Adding button to UINavigation Controller

    HI I want add abutton to UINAvigationController for header bar for navigation between two view.
     

Share This Page