On Oct 13, 2015, at 12:54 PM, David Duncan wrote:
>
>> On Oct 13, 2015, at 9:50 AM, Alex Zavatone <[email protected]> wrote:
>>
>>
>> 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
>
> Under what circumstance? I’ve never seen this reported by anyone, so this
> sounds like its either an error in your application or an edge case that I’m
> not aware of.
I've seen it a few times under iOS in viewControllers under viewDidLoad.
What I do is within the VDL after calling [super viewDidLoad], I have organized
methods for the following:
[self initData];
[self setupUIElements];
[self updateUIForAppSpecifics];
In the exact case where my code below was required was where I tried
self.navigationItem.leftBarButtonItem = leftButton within my setupUIElements
method.
And I waited 20 seconds for the UI to become responsive again and it updated.
So, really, I was trying to set the leftBarButtonItem within an iOS
ViewController's viewDidLoad.
As soon as I tried the GCD dispatch_async, it worked like a charm, so I ran
with it.
Thanks for the interest, David.
Alex Zavatone
> If you need to do this to update your bar button items, please submit a bug
> report with a sample demonstrating the issue. This code should not be
> necessary ever.
>
>> , 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/david.duncan%40apple.com
>>
>> This email sent to [email protected]
>
> --
> David Duncan
>
_______________________________________________
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]