Re: UIBarButtonItem exclusive touch
Re: UIBarButtonItem exclusive touch
- Subject: Re: UIBarButtonItem exclusive touch
- From: Leon Qiao <email@hidden>
- Date: Tue, 30 Aug 2011 14:51:27 +0800
Hi,
Thanks for your response !
I missed something.In the thread method "saveTheData", I do call the
popToRootViewController on the main thread by using
"performSelectorOnMainThread:".
It seems that both of the two functions(saveAction: and tableView's delegate
method) are invoked. And the navigation controller first pop all view
controllers to the root. And then push the detail view controller, and
sometimes it push to the detail view and then pop to the root. So is there
any tips about the synchronization?
Thanks again!
2011/8/30 Conrad Shultz <email@hidden>
> Sorry, I don't have time right now to fully respond, but first thing's
> first: UIKit is generally not thread-safe, so you should not invoke user
> interface actions (like popping a nav controller) on a secondary thread.
>
> This is a situation where GCD can make your life a lot simpler (with nested
> dispatch_async() calls)...
>
> (Sent from my iPhone.)
>
> --
> Conrad Shultz
> www.synthetiqsolutions.com
>
> On Aug 29, 2011, at 19:34, Leon Qiao <email@hidden> wrote:
>
> > Dear all,
> >
> > The UI I made is like the system app "Contact", there's an "add" bar
> button
> > on the navigation bar. And a table view where you can tap and enter the
> > detail view. The problem is when the user tap the bar button item and the
> > table view cell at the same time, it doesn't work well.
> >
> > The code here:
> >
> > Action for right bar button item:
> > - (IBAction)saveAction: (id)sender;
> > {
> > ...
> > ...
> > [NSThread detachNewThreadSelector:@selector(saveTheData)
> toTarget:self
> > withObject:nil];
> > }
> >
> > - (void)saveTheData
> > {
> > //some save action...
> > [self.navigationController popToRootViewControllerAnimated: YES];
> > //when complete, pop to the root
> > }
> >
> > Action for table view's delegate method
> >
> > - (void)tableView:(UITableView *)tableView
> > didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
> > DetailViewController *controller = [[DetailViewController
> alloc]init];
> > [self.navigationController pushViewController: controller animated:
> > YES];
> > [controller release];
> > }
> >
> > When using UIButton, we can set the exclusive touch property to avoid
> > tapping the two buttons at the same time. But what should I do for the
> table
> > view and the bar button item.
> >
> > Thanks a lot!
> >
> > Best regards
> > Leon
> > _______________________________________________
> >
> > Cocoa-dev mailing list (email@hidden)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> >
> > This email sent to email@hidden
>
--
Best regards
Leon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden