Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tools & Utilities

Reply
 
LinkBack Thread Tools Display Modes
Old 11-06-2010, 01:25 PM   #1 (permalink)
Registered Member
 
Whitehk's Avatar
 
Join Date: Feb 2010
Posts: 119
Whitehk is on a distinguished road
Default Clicking the editButtonItem done button doesn't end the editing

I have a UITableView. The left nav item is a edit button item. Whenever I click the edit button and try to click the done button to stop the editing, it won't do anything. What could be wrong? It was working fine not too long ago. What might I have deleted by accident? Here's my set editing method:

Code:
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
		[super setEditing:editing animated:animated];
		self.navigationItem.rightBarButtonItem.enabled = !editing;
}
Here's the code I use to create the button:

Code:
-(void)viewDidLoad {
	self.navigationItem.leftBarButtonItem = self.editButtonItem;
}
Whitehk is offline   Reply With Quote
Old 11-07-2010, 06:14 AM   #2 (permalink)
Steep Turn Software LLC
 
Join Date: Oct 2010
Posts: 32
ChrisG is on a distinguished road
Default

Why are you disabling the button in setEditing:animated:? It won't respond to input after you do that. The UITableViewController will manage changing the button itself, so the following code should be fine:

Code:
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
}
ChrisG is offline   Reply With Quote
Old 11-07-2010, 09:20 AM   #3 (permalink)
Registered Member
 
Whitehk's Avatar
 
Join Date: Feb 2010
Posts: 119
Whitehk is on a distinguished road
Default

Quote:
Originally Posted by ChrisG View Post
Why are you disabling the button in setEditing:animated:? It won't respond to input after you do that. The UITableViewController will manage changing the button itself, so the following code should be fine:

Code:
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
}
Oops. I didn't make it clear that the right bar button item was a button to add a cell to the table view, and the left bar button item was the edit button. Sorry about that. With the line of code you thought I was disabling the edit button item, I was really disabling the add button. Again, sorry about that.
Whitehk is offline   Reply With Quote
Old 11-07-2010, 10:16 AM   #4 (permalink)
Steep Turn Software LLC
 
Join Date: Oct 2010
Posts: 32
ChrisG is on a distinguished road
Default

I did overlook that there were two different buttons. The code you posted is pretty much the boilerplate code you get when you create a navigation based project in XCode, so I don't think the problem is there. The only thing I noticed is that you are not calling [super viewDidLoad] in your viewDidLoad method. However, I tried commenting that out on a test project and it didn't break the Edit button, so it doesn't seem likely that is the problem.
ChrisG is offline   Reply With Quote
Old 11-07-2010, 11:01 AM   #5 (permalink)
Registered Member
 
Whitehk's Avatar
 
Join Date: Feb 2010
Posts: 119
Whitehk is on a distinguished road
Default

Quote:
Originally Posted by ChrisG View Post
I did overlook that there were two different buttons. The code you posted is pretty much the boilerplate code you get when you create a navigation based project in XCode, so I don't think the problem is there. The only thing I noticed is that you are not calling [super viewDidLoad] in your viewDidLoad method. However, I tried commenting that out on a test project and it didn't break the Edit button, so it doesn't seem likely that is the problem.
Yeah. I'm at a complete loss. I guess I'll end up having to manually stop the editing. It's a lot more work, but oh well.
Whitehk is offline   Reply With Quote
Reply

Bookmarks

Tags
bar button item, editbuttonitem, navigation buttons, setediting, uitableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 423
11 members and 412 guests
AppleDev, chemistry, Emy, Gi-lo, ipodphone, mistergreen2011, pipposanta, Retouchable, skrew88, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,128
Posts: 402,923
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0