In my app I want to show a button item together the back button in the navigation bar. I read the doc of the UINavigationItem class and I found the property leftItemsSupplementBackButton that seems to be just for me. Then I used this line of code:
- (void)viewDidLoad{
[super viewDidLoad];
[self.navigationItem setLeftItemsSupplementBackButton:YES];
}
But when I run the app I get this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationItem setLeftItemsSupplementBackButton:]: unrecognized selector sent to instance 0x10faefb0'
and the 0x10faefb0 instance is:
_navigationItem UINavigationItem * 0x10faefb0
From the error seems that self.navigationItem doesn't have this property as is said in the apple class reference. Where i'm wrong?
That's for iOS 5 only. Are you running on iOS 4?
Related
I want to make a UIButton call a method in my tableView controller but it crashes every time I press that said button.
This button is located in my cell that as a custom class but I want the action of the button to be done in my tableviewController so I decided to add this code in the "cellForRowAtIndex" method:
cell.DeleteFromDevice.tag = 10;
[cell.DeleteFromDevice addTarget:self action:#selector(deleteVideos:) forControlEvents:UIControlEventTouchUpInside];
It is suppose to call the following method:
-(void)deleteVideos:(UIButton*)sender
What do I do wrong ? Can I make something like that or not ?
here is the error log:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[VideoTableViewController DeleteVideo:]:
unrecognized selector sent to instance 0x7fabbfe38720'
I have a master-detail app that is working great for the iPad. However, the iPhone version doesn't work because a variable that is being sent to the DetailViewController in the iPad version doesn't send to the iPhone DetailViewController. I can fix this with a single line of code in MasterViewController implementation:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
self.detailViewController=segue.destinationViewController;
}
Unfortunately, when I implement that code, the iPad version stops working. I get an exception when I go from another view controller (HomeViewController) back to DetailViewController. That error log is:
2012-07-14 14:29:12.924 46 Tracker[2772:11603] -[HomeViewController setDetailItem:]: unrecognized selector sent to instance 0x7cad4f0
2012-07-14 14:29:12.925 46 Tracker[2772:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HomeViewController setDetailItem:]: unrecognized selector sent to instance 0x7cad4f0'
*** First throw call stack:
(0x148a022 0x201acd6 0x148bcbd 0x13f0ed0 0x13f0cb2 0x2cb0 0x2d75c5 0x2d77fa 0xb6c85d 0x145e936 0x145e3d7 0x13c1790 0x13c0d84 0x13c0c9b 0x16a07d8 0x16a088a 0x246626 0x1fdd 0x1f45)
terminate called throwing an exception(lldb)
So, is there any way I can run that first block of code only when the user is on the iPhone? Or, can I fix the code to make it work properly on both devices?
Here is a link to my iPad storyboard to (hopefully) make it more clear. I have a problem when I click on a table cell AFTER going from HomeViewController back to DetailViewController: http://www.grapekeeper.com/storyboards.png
Perhaps the following?
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// perform iPad logic
} else {
// perform iPhone logic
}
Really basic question here:
I want to build an app that has a bunch of MasterDetail views that can be accessed from a TabView.
I'd like to start with the MasterDetail project template, but if I do that and toss a TabController onto the front of the storyboard, I get a crash.
2012-04-08 12:51:21.205 SMToolkit[22630:fb03] -[UISplitViewController topViewController]: unrecognized selector sent to instance 0x82491c0
2012-04-08 12:51:21.208 SMToolkit[22630:fb03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISplitViewController topViewController]: unrecognized selector sent to instance 0x82491c0'
*** First throw call stack:
(0x16ad022 0x183ecd6 0x16aecbd 0x1613ed0 0x1613cb2 0x2bf9 0x16386 0x17274 0x26183 0x26c38 0x1a634 0x1597ef5 0x1681195 0x15e5ff2 0x15e48da 0x15e3d84 0x15e3c9b 0x16c65 0x18626 0x2a6d 0x29d5)
terminate called throwing an exception(lldb)
All I've done so far is in the storyboard (literally I made a new MasterDetail project, then went into the storyboard and put a tabcontroller in front of it)
Simple answer is that the template provided for you in Master Detail includes some code you probably don't want.
In AppDelegate.m look for the following method and simply have it return YES;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
I am writing an app for iPad. I have several views. On navigation bar I have 2 buttons for shopping cart and youtube. pressing them takes to the browser in the app itself. I have made another class for browser and added an outlet for UIWebView. In browser class viewDidLoad method I wrote the following lines.
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.hidesBackButton = YES;
self.title = #"Browser";
[webView loadRequest:[NSURL URLWithString:#"http://cfsmail.com"]];
}
The build is successful and app runs. But when I press any of those buttons it terminates with following error.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL URL]: unrecognized selector sent to instance 0x4b39600'
Please guide
Regards
Prateek
What you are doing wrong is that loadRequest requires a NSURLRequest, not NSURL. Try:
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://cfsmail.com"]]];
i used the following code to display my image picker controll.
IPopoverController *popoverController = [[[UIPopoverController alloc] initWithContentViewController:myImagePicker] retain];
[self presentModalViewController:popoverController animated:YES];
but there is a error that shows
working with image view[14335:207] *
Terminating app due to uncaught
exception
'NSInvalidArgumentException', reason:
'-[UIPopoverController
modalTransitionStyle]: unrecognized
selector sent to instance 0x6415950'.
can any one help me please.
You need to use this...
[popoverController presentPopoverFromBarButtonItem:sender
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Or one of the other present methods, check the Apple docs.
The short answer is that you cannot use UIPopoverController to present it as a modal one. Please try using UIViewController instead.
You probably will need to subclass it and either load it from some nib or create its view content manually in loadView method.