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 04-28-2010, 10:13 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 37
Knodel is on a distinguished road
Default UISplitView problem

I have an app with a UISplitView. In the root view I have a UITableView with two levels. In the Detailed view I have a UIWebView. I need to show content when user selects a row of second-level table (of course, different content for different rows). There are lots of tutorials about this, but everywhere the table has one level.

This is how I build the table:

Code:
#pragma mark -
#pragma mark View lifecycle

- (void)viewDidLoad {
    [super viewDidLoad];
	if(CurrentLevel == 0) {
		
		//Initialize our table data source
		
		SplitViewAppDelegate *AppDelegate = (SplitViewAppDelegate *)[[UIApplication sharedApplication] delegate];
		self.tableDataSource = [AppDelegate.data objectForKey:@"Rows"];
		
		self.navigationItem.title = @"Title";
	}
	else 
		self.navigationItem.title = CurrentTitle;	
    self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}


#pragma mark -
#pragma mark Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
    // Return the number of sections.
    return 1;
}


- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    return [self.tableDataSource count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }
    
    // Set up the cell...
	NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
	cell.text = [dictionary objectForKey:@"Title"];
	
    return cell;
}
#pragma mark -
#pragma mark Table view delegate


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	RootViewController *rvController = [[RootViewController alloc] init];
	//Get the dictionary of the selected data source.
	NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];

	//Get the children of the present item.
	NSArray *Children = [dictionary objectForKey:@"Children"];
	
	if([Children count] != 0) {
		//Prepare to tableview.
		//Increment the Current View
		rvController.CurrentLevel = 1;
		
		//Set the title;
		rvController.CurrentTitle = [dictionary objectForKey:@"Title"];
		
		//Push the new table view on the stack
		[self.navigationController pushViewController:rvController animated:YES];
		
		rvController.tableDataSource = Children;
		[rvController release];
		
	}
    detailViewController.detailItem = [self.tableDataSource objectAtIndex: indexPath.row];

}
How can I make the UIWebView load a corresponding webpage?
Knodel is offline   Reply With Quote
Old 09-07-2010, 04:11 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 92
spoolup is on a distinguished road
Default ...

did you have any luck with this?
i'm trying to figure out the same thing.... stuck
spoolup is offline   Reply With Quote
Old 09-11-2010, 01:56 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 37
Knodel is on a distinguished road
Default

No, I've released my app with a simple UITableVIew
Knodel is offline   Reply With Quote
Old 09-13-2010, 02:41 AM   #4 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 92
spoolup is on a distinguished road
Default ....

Quote:
Originally Posted by Knodel View Post
No, I've released my app with a simple UITableVIew
bummer i've been looking for this too.......
spoolup is offline   Reply With Quote
Old 09-13-2010, 05:04 AM   #5 (permalink)
Registered Member
 
kelvinkao's Avatar
 
Join Date: Jul 2009
Location: Los Angeles
Posts: 352
kelvinkao is on a distinguished road
Send a message via AIM to kelvinkao
Default

Well, I haven't tried this myself but the split view controller just require view controllers and it doesn't really care what kind it is. Right now you probably have some kind of RootViewController that's a subclass of UITableViewController. You just need to change it to an UINavigationController and do everything else accordingly, like pushing table view controllers onto the stack, changing the setup in interface builder, etc.
__________________
My dev blog:
http://www.kelvinkaodev.com
kelvinkao is offline   Reply With Quote
Reply

Bookmarks

Tags
ipad, uisplitview

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: 328
21 members and 307 guests
Abidullah, baja_yu, cgokey, Domele, Duncan C, Fstuff, gbenna, givensur, guusleijsten, HowEver, iphonedevshani, jbro, JoeRCruso, mdpauley, n00b, newDev, seokwon lee, SLIC, stanny, Steven.C, WheyLabs
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,876
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

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