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 Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-25-2010, 05:18 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default UIViewController containing UITableViewController

I have a UIViewController that has a custom UITableViewController inside it.

I can get the view to load but the class that is set to load the data for UITableViewController isn't working.

I have my table view wired in IB correctly to the controller.

When I push the UIViewController onto the navigationController only the UIViewController gets notified of the viewWillAppear notification...

How do I make sure the UITableController also gets notified correctly?
cynistersix is offline   Reply With Quote
Old 06-25-2010, 05:28 PM   #2 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

Only the UIViewController pushed gets messages like viewWillAppear. The only way I've found is to fake it by calling the UITableController's viewWillAppear from inside the UIViewController's method.
JasonR is offline   Reply With Quote
Old 06-25-2010, 05:42 PM   #3 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default

Quote:
Originally Posted by JasonR View Post
Only the UIViewController pushed gets messages like viewWillAppear. The only way I've found is to fake it by calling the UITableController's viewWillAppear from inside the UIViewController's method.
Ok so it is working correctly then it seems you cannot have a UIViewController that contains a UITableController in a simple manner. I have it all wired up correctly but the table wont load any data since it isn't receiving some of the necessary messages then. I can make that viewWillAppear call but it seems its too late or something else is going on cause that alone does not fix this. The data is still not loaded.

I have an enumeration call inside the tablecontroller's viewWillAppear but it wont run it when it isn't the one receiving the messages
cynistersix is offline   Reply With Quote
Old 06-25-2010, 05:54 PM   #4 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

It really shouldn't be that hard. You might want to post your enumeration code, because there's no reason I can see why the UITableViewController should behave any differently if it's viewWilAppear is called by the parent UIViewController's viewWillAppear.

Also, how are you loading the UITableView itself into the parent UITableViewController? If you did this too late, it could also cause the problem you are describing. I would expect you should do it in the parent UIViewController's viewDidLoad at the latest.
JasonR is offline   Reply With Quote
Old 06-25-2010, 06:04 PM   #5 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default

Quote:
Originally Posted by JasonR View Post
It really shouldn't be that hard. You might want to post your enumeration code, because there's no reason I can see why the UITableViewController should behave any differently if it's viewWilAppear is called by the parent UIViewController's viewWillAppear.

Also, how are you loading the UITableView itself into the parent UITableViewController? If you did this too late, it could also cause the problem you are describing. I would expect you should do it in the parent UIViewController's viewDidLoad at the latest.
The enumeration code works when I only push the tableviewcontroller and not its parent which is odd and the table shows up when I do this.

I haven't added anything specifically to the code to load the UITableView (I'm using the WWDC10 sample for the MyImagePicker). The view has its own xib that assigns the view of the controller to the table object in the layout.

Here's my enumeration block:

ALAssetsGroupEnumerationResultsBlock assetsEnumerationBlock = ^(ALAsset *result, NSUInteger index, BOOL *stop) {

if (result) {
[assets addObject:result];
}
};
cynistersix is offline   Reply With Quote
Old 06-25-2010, 06:13 PM   #6 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default

I'm not getting notified of the viewDidAppear either is that on par with the viewWillAppear?

I am getting notified of viewDidLoad in the TableViewController
cynistersix is offline   Reply With Quote
Old 06-25-2010, 06:15 PM   #7 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

Yes, none of the view...Appear functions will be called unless you call them from the UIViewController being pushed. I believe it's the same with the viewWillDisappear in case you are using it too.
JasonR is offline   Reply With Quote
Old 06-25-2010, 07:36 PM   #8 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default

Quote:
Originally Posted by JasonR View Post
Yes, none of the view...Appear functions will be called unless you call them from the UIViewController being pushed. I believe it's the same with the viewWillDisappear in case you are using it too.
Still not working... I have the delegate and dataSource on the TableView set to the TableViewController in the xib for the viewcontroller.
cynistersix is offline   Reply With Quote
Old 06-25-2010, 07:46 PM   #9 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

Sorry, without more code posted, I have no idea what you are doing wrong. If you can't share more information, there's really no way I can see to help.
JasonR is offline   Reply With Quote
Old 06-25-2010, 07:53 PM   #10 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default

Quote:
Originally Posted by JasonR View Post
Sorry, without more code posted, I have no idea what you are doing wrong. If you can't share more information, there's really no way I can see to help.
Here's a sample of what I'm trying to do:

Sample Code
cynistersix is offline   Reply With Quote
Old 06-25-2010, 08:05 PM   #11 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

My company won't let me download from there, so I'll have a look when I can this weekend.
JasonR is offline   Reply With Quote
Old 06-25-2010, 08:53 PM   #12 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default

Quote:
Originally Posted by JasonR View Post
My company won't let me download from there, so I'll have a look when I can this weekend.
Whats your email? its only 1 meg
cynistersix is offline   Reply With Quote
Old 06-28-2010, 11:00 AM   #13 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 16
cynistersix is on a distinguished road
Default

Quote:
Originally Posted by cynistersix View Post
Whats your email? its only 1 meg
Ok I fixed it using this sample to integrate and change my implementation for now. It should be possible however to modularize the view the way I'm intending to. So, if you do get a chance to take a look at the code I would still be interested to see what I was doing wrong. Thanks.
cynistersix is offline   Reply With Quote
Old 06-29-2010, 01:43 AM   #14 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

Sorry I'm only now getting to look at this, I was slammed over the weekend.

The only way I know how to do what you want is to manually add the view of the UITableViewController as a subview to the UIViewController you want it to be inside of. I don't think IB can do that step for you.

Unfortunately, I have no idea how to get your app to run in the simulator, and I don't have a iOS4 device, so I could not test it. Personally, I think you are better off following the link you posted.
JasonR is offline   Reply With Quote
Reply

Bookmarks

Tags
navigationcontroller, uitableviewcontroller, uiviewcontroller, viewwillappear

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: 326
7 members and 319 guests
anothermine, Chickenrig, Domele, givensur, michaelhansen, PixelInteractive, Sloshmonster
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,892
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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