I'm new to iOS development, and I have a big headache, not understanding something that can be pretty easy. I mainly use the UITableViewController to switch to another UITableViewController, but then I need to switch from this second UITableViewController to the UIViewController. I want this UIViewController to have a .xib file for me to make a quick interface, but I cannot find a way to click from the second UITableViewController on this UIViewController. I was able to programmatically show the label, but not the user interface from .xib.
This is the code that works with the program label:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { self.detailController.title = @"Disclosure Button Pressed"; NSString *selectedMovie = self.movies[indexPath.row]; NSString *detailMessage = [[NSString alloc] initWithFormat:@"This is details for %@.", selectedMovie]; self.detailController.message = detailMessage; self.detailController.title = selectedMovie; [self.navigationController pushViewController:self.detailController animated:YES]; }
And this is the -.m UIViewController, which works to programmatically display the UILabel.
@implementation BIDDisclosureDetailViewController - (UILabel *)label; { return (id)self.view; } - (void)loadView; { UILabel *label = [[UILabel alloc] init]; label.numberOfLines = 0; label.textAlignment = NSTextAlignmentCenter; self.view = label; } - (void)viewWillAppear:(BOOL)animated; { [super viewWillAppear:animated]; self.label.text = self.message; } @end
Basically, I don't want every UIObject to be software, I need .xib to create a user interface.
thanks
(iOS 6 without using storyboards)
source share