iPhone app autorotates on one device, but not another - iphone

Does anyone know of a reason why an iPhone would autorotate on one device, but not another? I can't reproduce it on my iPhone, iPod Touch, or any of the simulator devices.
Are there any device settings I should be paying attention to? The offending iPhone has the same SDK version installed (4.2.1), but is a different model (MC319LL) than mine (MC605DN).

Well, I never figured out why the two phones were acting differently, but this bit of code in in the UITabBarController subclass seems to have solved things:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return toInterfaceOrientation == UIInterfaceOrientationPortrait;
}

You made sure that the misbehaving device had its rotation lock turned off in the settings, right?

Related

Views are portrait in older versions

I have a problem here and am not able to come up with answer why my app is behaving so.
I made application using XCode 4.5+ and iOS6 and have set my application to work in landscape mode it was working and running fine till I tried to run it in previous version like iOS 5.1 simulator or below all views are in portrait mode :(
You can try defining this method in your controllers:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return ( interfaceOrientation == UIInterfaceOrientationPortrait)ç
}
This plays the same role as shouldAutorotate for iOS6.
as suggested by tkanzakic - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOr‌​ientation solved my problem with lower versions thanks a lot :)

iPhone 5.0 and 5.1 Simulators Not Calling IBActions?

I have an app with a target of iOS 5.0. Unfortunately, I no longer have any test devices with iOS 5.
I'd like to be able to use the iOS 5.0 and 5.1 simulators to do basic debugging, but for some reason, my IBActions aren't being called on these simulators.
Further info:
Xcode version is 4.5.2
All simulators are up-to-date (no pending updates/downloads available)
We do have customers who use iOS 5 and 5.1, and they don't have any issues clicking the buttons (or at least, we haven't received any reports about such from them ; )
On the iPhone 6.0 simulator, everything works as expected (pretty sure all IBActions are connected correctly)
Are these simulators just terribly buggy (is this a known issue)? Have others ran into this issue and know a fix?
It turns out that a UITapGesture on self.view was capturing the touches and NOT forwarding to the subviews... for some reason, this behavior appears to be different in iOS 6 and iOS 5 simulators... user beware...
Most Probably issue i seen that..
might be you not define your IBAction method in .h file.
might be you connect two IBAction on one UIButton TouchUpInside.
you also try uninstall app from simulatore clear xcode than might be solve your issue.
reset you simulator contain.
Check is any update of Xcode then you try to run your app then you got solution.
I am working on same configuration and i have no issue like yours..
Use UIGestureRecognizerDelegate to avoid effect of gestureRecognizer on a selectedView:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)recognizer shouldReceiveTouch:(UITouch *)touch {
UIView *selectedView = self.view;
CGPoint point = [touch locationInView:self.view.superview];
if (CGRectContainsPoint(selectedView.frame, point)) {
return NO;
}
else {
return YES;
}
}

Making 2 Separate App Delegates For Universal App?

Should I make 2 separate app delegates for a universal app? One myAppDelegate, then myAppDelegate_iPhone and myAppDelegate_iPad which are subclasses? Reason being iPhone should have IBOutlet of NavController while iPad should be UISplitViewController.
Also, how do I separate actions between iPhone and iPad. For example, a button on iphone may push a view, but on iPad i want to have a small window popup instead rather than a full-screen push. Do I just use a if/else statement to check if iPad (by uiswitchviewcontroller), then go from there?
if (NSClassFromString(#"UISplitViewController") != nil && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//currentDeviceType = iPad;
}
else {
//currentDeviceType = iPhone;
}
This question seems to be along similar lines.
Universal iPhone/iPad AppDelegate
This doc from Apple might also prove helpful.
Introduction to Universal Apps
No need to take two separate application delegates. You can code on the condition...
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){}
This will automatically detect the device.
To enable rotation on the device, you need to return YES to
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
FOR ALL OF YOUR VIEW CONTROLLERS.
You should also add your supported orientations to your plist or info under xcode 4.
Also keep in mind that stack overflow prefers that a new question be asked when the question topic changes :)

Re-enable landscape orientation in Xcode 4

I temporarily disabled landscape orientations in my iPhone app while I fixed a problem with an image. Now, for the life of me, I can't get any pages to AutoRotate to either landscape orientation. It worked fine previously. I have all 4 orientations identified in the UISupportedInterfaceOrientations in the info.plist. All 4 orientations are highlighted in the Targets Summary Supported Device Orientations. My implementation files all have:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
I'm sure it's something stupid I'm missing, but I can't find it after trying for hours. Any thoughts????
If you are certain that each viewController has
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
then you may want to try deleting the Build/ directory, selecting clean all targets in the build options, and then relaunching the app. Sometimes this miraculously works. Also, closing and re-opening the simulator and/or Xcode is a common mystery solution for me.
If this doesn't work, then you may want to read through Apple's trouble shooting guide: Why won't my UIViewController rotate with the device?
You may want to clean all targets - the updated plist may not be getting copied into the app bundle. If this is on the device, you may try deleting the app from the device as well.

UI autorotation works only on some devices?

I'm having quite interesting (but very annoying) problem with (not only) UI autorotation. I'm working on the app which contains tabbar controller with couple of navigation controllers as tab items. One of those controllers allows for autorotation to landscape mode.
Interesting is that it perfectly works in Simulator as well as on my own device, but it's not working on other testing devices. All devices are the same - iPhone 3G 16 GB, OS version 3.1.3.
When I'm looking for a log messages which report orientation change events in console, I can find it again only on my device, but not on other devices, so it seems that other devices do not report orientation change at all. Which is very unlikely on the other hand, because other apps are working normally... Also some other features which are working on my phone are not working on other devices too (touch events handling in tableview for instance).
I've never seen something like this and cannot find any reason why the hell it should not work on all devices the same way! So the question is - am I mad or what?
I use subclass of UITabBarViewController with overriden method
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation {
BOOL shouldRotate = (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
NSLog(#"Should rotate: %d", shouldRotate);
return shouldRotate;
}
Then I handle orientation change animation in respective methods (willRotate..., willAnimateRotation...). But as I said - it works fine on my device, but on other devices the shouldAutorotateToInterfaceOrientation: method gets never called. Weird!
Please give me some hint before I'll end in a madhouse. Thanks for any tip.