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
Related
I want to transition from one view controller into another when clicking a table cell without any additional data passing. Here is a screenshot of my storyboard: http://imgur.com/C8yTRaZ
However, it doesn't go to the second view controller when I am clicking on the table cell. They are both embedded in the navigation controller (I think; since the "Navigation Item" is in both controllers). What am I missing?
Make sure you have mapped your table data source and table delegate to self.
For that you could use didSelectRowAtIndexPath in that you could programmatically call that other view Controller.
Like below:-
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
ViewController *viewController = [[ViewController alloc] init];
[self presentViewController:viewController animated:YES completion:nil];
}
This will help you out.
Make sure that 'user interaction' for both 'table view' and 'table view cell' should be enabled.
I'm trying to build my iOS app's interface. Starting over and over with new project i'm still getting a problem with a detail view's controls (see picture).
Here i got the screenshots:
detail view shows when user touch to the UITableView row. You can see the difference between my design and final result on the simulator screen - this is the problem
main xib design
this is how i open the detail view:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:#"DetailViewController" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
}
autolayout - that is the source of bugs in my design. I just switched it off on the detail xib and now all controls are in its right places
thank you Rob
I am working on UISplitView Controller. I have used a SplitView controller template of Xcode. Actually i wanted to implement a scenraio in which when i click on table view cell it should add a New Root Controller with a table View into the Navigation Stack.
i did it using the following code
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NextViewController *nextView = [[NextViewController alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:nextView animated:YES];
[nextView release];
}
It works perfect and i have used the RootView Controller code into the NextViewController so that when we click on New Screen's cell it should update my Detail Screen. But unfortuantely it is not updating my Detail Screen.
What can be the reason ??
Please help friends..
Thanks
To updating your Detail Screen. you need to implement a delegate method of communication between Current RootView controller and Detailview controller.
Best Wishes,
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.
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.