On Oct 13, 2015, at 9:34 AM, Alex Hall wrote:
>
>> On Oct 13, 2015, at 09:31, Alex Zavatone <[email protected]> wrote:
>>
>> FWIW, I have found no way to do this but in code.
> Really? That's annoying, since Xcode offers what seems like such a simple
> solution right in the inspector. I wonder if it's an Xcode bug, or if I'm
> misunderstanding what that text field in the inspector does? If it's a bug,
> I'll file it, though I'm sure many others already have.
Yeah, I noticed long ago, (Xcode 4.3?) that the text I had entered in the
storyboards for the name of the back button no longer was obeyed in the screens
that I created. Maybe it was iOS 6, but I forget.
Today, I create the a UIBarButtonItem with a title and set it to the
self.navigationIdem.leftBarButtonItem using a GCD dispatch_after.
I tried doing it directly, but the UI would wait for 20 seconds before it took,
so I used a GDC dispatch and it gets the job done.
Here is is in a little method for you. You can modify it to pass in the
selector so that it's more general purpose.
Notice the commented out line below the closing paren. Try commenting out the
dispatch and using that instead and watch as your UI takes 20 seconds to update.
- (void) createBackbuttonWithTitle (NSString *)buttonTitle {
UIBarButtonItem *leftButton = [[UIBarButtonItem alloc]
initWithTitle:NSLocalizedString(buttonTitle, nil)
style:UIBarButtonItemStyleDone target:self action:@selector(dismiss:)];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .5 * NSEC_PER_MSEC),
dispatch_get_main_queue(),
^{
self.navigationItem.leftBarButtonItem = leftButton;
});
// self.navigationItem.leftBarButtonItem = leftButton;
}
Hope this helps ya out.
Cheers,
Alex Zavatone
>>
>> Sent from my iPhone
>>
>>> On Oct 12, 2015, at 9:11 PM, Alex Hall <[email protected]> wrote:
>>>
>>> Hi all,
>>> I have a navigation item inside a view, which is a couple levels inside a
>>> navigation controller's stack. I can change the title of the navigation
>>> item through the "title" attribute (in IB) with no trouble. However, when I
>>> entered some text for the "back button" title, Xcode shows that text in the
>>> Attributes Inspector, but it isn't used in my app. Instead of "cancel" as I
>>> wrote, I get the standard "[previous view name] back" text instead. I'm
>>> assuming I've missed a step, but I'm not sure what. Thanks for any
>>> suggestions; I know this must be an easy fix, but the only things I can
>>> find online are all doing this with code.
>>>
>>> --
>>> Have a great day,
>>> Alex Hall
>>> [email protected]
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Xcode-users mailing list ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/xcode-users/zav%40mac.com
>>>
>>> This email sent to [email protected]
>
>
> --
> Have a great day,
> Alex Hall
> [email protected]
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com
This email sent to [email protected]