Note that there are some explanatory texts on larger screens.

plurals
  1. PONavigation controllers toolbar goes blank after showing a UIActionSheet from it
    primarykey
    data
    text
    <p>In an iOS run on iOS 6.1 (emulated) and 6.1.3 (physical device) application we show an UIActionSheet from a view with the following code:</p> <pre><code> UIActionSheet *actionCreateNewComment = [[UIActionSheet alloc] initWithTitle:CLocalised(@"EditExistingComment") delegate:self cancelButtonTitle:CLocalised(@"No") destructiveButtonTitle:nil otherButtonTitles: CLocalised(@"Yes"), nil]; [actionCreateNewComment setActionSheetStyle:UIActionSheetStyleBlackOpaque]; [actionCreateNewComment setTag:ActionSheetTagNewComment]; [actionCreateNewComment showFromToolbar:self.navigationController.toolbar]; [actionCreateNewComment release]; </code></pre> <p>The View sets the toolbar with:</p> <pre><code>UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:control]; [self setToolbarItems:[NSArray arrayWithObject:item]]; </code></pre> <p>Where <code>control</code> is an <code>UISegmentedControl</code>.</p> <p>The code for handling the button actions are:</p> <pre><code>-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ bool shouldAddNewComment = buttonIndex == [actionSheet cancelButtonIndex]; [self navigateToCommentScreen:shouldAddNewComment]; } </code></pre> <p>Every time this action sheet is shown the tool bar will go "blank". Not only for this view but also for the other views.</p> <p>Here is an example of a work flow: <img src="https://i.stack.imgur.com/CZvtI.jpg" alt="Flowbetween Views"></p> <p>Note that if I navigate from Instr to Comment without the UIActionSheet, but otherwise the same code, the problem will not appear.</p> <p>The problem here is that in the "Instr" view the toolbar is empty. If I pop two more views to return to "List" its toolbar will be empty as well:</p> <p><img src="https://i.stack.imgur.com/XoT92.jpg" alt="ListEmpytToolbar"></p> <p>Even if I then navigate back to WO and Instr, by allocing and init new forms, and then pushing them, the toolbars will still be empty.</p> <p>There is another navigation option from the "List" View that shows a "Summary" view. Depending on the data this view will show with or without buttons in the toolbar: <img src="https://i.stack.imgur.com/3FqK1.jpg" alt="Stats of summary view"></p> <p>Both "Summary Button" and "Summary empty" are intended views. "Summary hidden" is shown after the UIActionSheet have been shown before navigating between Inst and Comment. But if I navigate to a "Summary" view that is shown as "Summary Empty" in the picture (intended, due to the data) then the toolbar will start working everywhere again. Or at least until I show the UIActionSheet from the Instr view again.</p> <p>There are some, in my opinion, strange things about this:</p> <ul> <li>If I navigate to a view where the toolbar is empty, which hides the toolbar, see pic: "SummaryEmpty", then the toolbar will show as intended in the other views.</li> <li>We use the same code to show an action sheet in other views of the application without any problem</li> <li>If I run the application on an emulated iOS 5.1 or emulated iOS 5.0 the problem does not appear</li> </ul> <p>Have I missed something when it comes to dismissing the action sheet or how to show it?</p> <p>Please let me know if you want more information.</p> <p>Update: If I forcibly call <code>[self setToolbarItems:nil]</code> after the action sheet button event and then update it with the same items as before the Tool bar will show up as intended. This does not feel as the right way to do it.</p> <p>Update 2013-05-28: Thanks to @LOP_Luke I found out that if I do not navigate to the "Comment" view from <code>-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex</code> but just returned the tool bar will start working again. So, can there be some kind of problem when I navigate to another view when then <code>clickedButtonAtIndex</code> is still on the call stack?</p> <p><strong>Update 2013-05-29</strong>: If I add a method:</p> <pre><code>-(void)commentScreenYes{ [self vanigateToCommentScreen:YES]; } </code></pre> <p>And change the button code to:</p> <pre><code>-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ bool shouldAddNewComment = buttonIndex == [actionSheet cancelButtonIndex]; if(shouldAddNewComment){ [self performSelectorOnMainThread:@selector(commentScreenYes) withObject:nil waitUntilDone:NO]; return; } [self navigateToCommentScreen:shouldAddNewComment]; } </code></pre> <p>Then it will work for the cancel button, but not for the yes button. The cancel button will also make the toolbar work again after it have been "broken" by the yes button. If I pipe both buttons through this flow (by adding a new method) they will both work. And still, if I run it at iOs 5.1 it will work no matter which flow I choose.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload