I have created a basic Split View and instead of loading a UIView on the right hand side, I have loaded a UITableView. The UITableView is made up of UITableViewCell's and what I want to do is when I click on the Cell, it loads up another UITableView for selection much like that in the iPad settings. However I cannot the UITableView to load after selection.
Any ideas how to achieve this? I've seen similiar questions and had a look at the apple site with uitableviews but haven't been able to solve the issue as they're geared towards iphone which doesn't have the split view.
On the didSelectRowAtIndexPath i've loaded it like so which other apps have done but to no avail.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if(indexPath.row == 0)
{
LevelTwoController *leveltwoController = [[LevelTwoController alloc] initWithNibName:#"LevelTwoTableView" bundle:nil];
[self.navigationController pushViewController:leveltwoController animated:YES];
[leveltwoController release];
}
}
Another thing also is my leveltwoController is a UITableViewController and I just keep getting this import error literal-pointer#_OBJC#_cls_refs.
Your main view that has the TableViewController needs to be controlled by a UINavigationController, and then you could push the subsequent views onto the view stack. My guess is your current implementation is having self.navigationController be nil so nothing is happening.
If you take a look at some of the basic xcode templates that use uinavigationcontroller's you should be able to figure out the proper path.
Related
Okay, I got this strange situation.
I have multiple tableViews in my project, but only on one tableView I can click on an item and perform an action (go to next segue).
On the other tableViews I can click what I want but nothing happens.
I removed the one that was working and made the link again, and it was still working. What am I missing?
I'd like to suggest to you to use the delegate method to handle item selection:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Here you can do something with, e.g. push a view controller:
id vc = [self.storyboard instantiateViewControllerWithIdentifier:#"myVC"];
[self.navigationController pushViewController:vc animated:YES];
}
In most cases it is more comfortable to implement and maintain table views with delegates instead of using segues.
I am trying to do a simple Navigation controller controlled by a UITableView. Whenever I select one of the rows it is supposed to go to the next slide and animate there. Whenever I implement this code, the animation only goes halfway, then freezes, and then disappears.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
description* desc=[[description alloc] init];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self.navigationController pushViewController:desc animated:YES];
}
Can anyone help? Thanks in advance.
I don't know if this is the same problem, but something similar happened to me. The problem was that the backgroundColor of the UIView of my pushed UIViewController was clear, which cause the animation to look weird because we can see the pushing UIViewController underneath.
Setting backgroundColor on the UIView of the pushed UIViewController (in my case, in white) solved the problem
I am facing a strange issue. I have a simple iPhone app with a TableViewController with custom TableViewCell that is parsing data using NSXmlParser and displaying it. The image inside the cell is loaded with SDWebImage library. Tapping on a cell will push the detail view controller which uses the link to show the post inside the UIWebView. Simple as that.
PROBLEM: When i tap on the cell and it shows the UIWebView, after that if i come back to the TableViewController, it stops scrolling. It bounces but doesn't go down where it has already loaded more cells.
I don't know where exactly the problem could be otherwise i would have added the code. Let me know if anybody wants some particular piece of code they want to see in order to find the problem. This is how i am pushing to the detail view:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
WebViewController *wvc = [self.storyboard instantiateViewControllerWithIdentifier:#"WebViewController"];
TheItem *entry = [[channel items] objectAtIndex:[indexPath row]];
wvc.urlString = entry.link;
[self.navigationController pushViewController:wvc animated:YES];
}
UPDATE: No matter even i select the last cell in the table view, when i come back from the detail view, the position of the scroll is at the top and stuck there.
I have an app with two bar in it.
one of the tab .xib includes UITableView, when the user select one of the cells, I want to show another UIViewcontroller (.xib file) that includes information about the his selection.
now, I've tried this
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath {
NextViewController *nextController = [[NextViewController alloc] initWithNibName:#"NextView" bundle:nil];
[self.navigationController pushViewController:nextController animated:YES]; [nextController changeProductText:[arryData objectAtIndex:indexPath.row]];
}
and nothing happened, the console is showing no errors at all.
what seems to be the problem?
thanks!
Nothing happened, because your self.navigationController returns nil.
For proper usage of Navigation controller, you must have at least one. For the case of TabBar application, for each tab you must associate not the UIViewController subclass, but UIViewController subclass nested in UINavigationController. That's easily done both in the .xib or in code. Just google for some tutorials.
Hi
anybody can explain of how to show a splitview when I tap a row from a cell??
or a tutorial of it??
I have a tableview, and i want to display information about that cell in a splitview.
Thanks
I don't think there's a tutorial for that, since you're not supposed to do that.
The split view controller is supposed to be the root view controller of your application, so if you want a pushable split view controller you'll have to write it yourself (or possibly find an open source one).
I want to implement an app that when it press a row from a table, it will open a splitviewcontroller that show the information
about the selected cell in the "detail´s splitview" , and all the info of the table in the "rootview".
I have copy to my project the
DetalviewController.h/m
RootViewController.h/m
DetailView.Xib
files from the splitview template.
And add this code to my tableviewcontroller:
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Initialize the controller.
if(split == nil)
split = [[RootViewController alloc] initWithNibName:#"split" bundle:[NSBundle mainBundle]];
//Pass the current row number to the sub view controller.
split.number = indexPath.row;
//here is my problem, i cant add the new view, and it crash
[self.view addSubview:[split view]];
}
enter code here