Universal app popover in iPad version - ipad

I am converting an iphone app to the iPad version and I am trying to use a popover in a view in the iPad version.
I am getting an apple mach-o linker id error which disappears when the popover view files are deleted from the project.
Is there any build settings changed/frameworks added when using popovers?

if you want to compile application for both devices you can put
__asm__(".weak_reference _OBJC_CLASS_$_UIPopoverController");
__asm__(".weak_reference _OBJC_CLASS_$_UIPopoverControllerDelegate");
into your Prefix.pch. It will remove errors, but you still won't be able to access those Objects - you will have to add if's to check if you running on iPhone or iPad and present information differently.
something like:
static BOOL isDeviceIPad(){
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) {
return YES;
}
#endif
return NO;
}

Related

Disable some classes when building on ios6 [duplicate]

Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}

How to disable changing of orientations in iOS 5.1.1 after rotation?

I would like to know how to disable Portrait and UpsideDown orientations in my app for iOS 5.1.1.
I want my app to use only LandScape orientation (interface was drawn in Interface Build in .xib file) and don't change it in case of rotation.
I need it especially for iOS 5.1.1
A similar question: how do you make an app ONLY support landscape?
This method was used in the answer above:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
return YES;
return NO;
}
You can set it in project settings. In xCode 5 you open the project navigator, click on your project, click on the general tab, and check the boxes you want.

Change GUI when selecting iOS 6 in Xcode 5

When I am using Xcode 5 and I set the deployment target as 7.0, the application runs perfectly with both 4-inch and 3.5-inch displays.
I have downloaded the iOS 6 SDK already.
When I change the base SDK to iOS 6 and set the deployment target as iOS 6.1 my GUI is affected in a way that changes every image, navigation bar, images and all other controls.
I am not using autolayout and have two .xib files for one UIViewController in each class.
So, how can I get fix this?
Thanks in advance.
When you compile with the iOS 6 SDK , you application is created with the iOS6 images, views, keyboards, etc...
You can't use iOS7 views if you are compiling for iOS6, you need to compile for iOS7, even thought your app is iOS6 compatible (setting the deployment target to iOS6)
Long story short - you can't use iOS 7 GUI in your iOS 6 app. If you want you can just create your custom GUI and use it in your app. But some elements will be different, you better read this guide:
Apple docs
Also if you build you app for different versions of iOS you better use auto layout:
Ray Wenderlich - Auto Layout Tutorial in iOS 7: Part 1
Ray Wenderlich - Auto Layout Tutorial in iOS 6: Part 1
Some issues of transition from iOS 6 to iOS 7:
Status bar and navigation bar issue in IOS7
Use this code:
if([[[UIDevice currentDevice] systemVersion] isEqualToString: #"7.0"])
{
//do stuff
}
else
{
// code here
}
When compiling for iOS 7 you are using iOS 7 specific GUI elements (that differs a lot from iOS 6). Phones that are still on iOS 6 (about 16%) will however see the iOS 6 GUI elements for obvious reasons, even if you compile it for iOS 7.
There is really no way to resolve this, you should simply develop for iOS 7 and let iOS 6 users still have iOS 6 GUI elements.
If your application is working fine in iOS 7 and you need to run it iOS 6 then you need to manage the application using this method:
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending){
//CGRect gridFrame;
if ([[UIScreen mainScreen] bounds].size.height == 568) {
// Do nothing if already managed
}else{
// Do nothing if already managed
}
}else{
//CGRect gridFrame for ios6;
if ([[UIScree`enter code here`n mainScreen] bounds].size.height == 568) {
//Manage frame here
}else{
//Manage frame here
}
}

How to execute a block of code in IOS7 not in IOS6?

Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}

iPhone app has stretched in the iPad

I want to test an iPhone app on the iPad, but I only have iPad now. IOS5.1 & Xcode 4.3.1 that are my environment and I set the same storyboard in the project TARGETS, the app runs on the iPad has been fullscreen displayed (all of the UILayouts have been stretched), cannot show any view switch in the app.
How can I run the same size app on the iPad?
You need to change the app target from Universal to iPhone.
Go to [Project Targets] > Summary > iOS Application Target > Devices > iPhone
This way the iPad will open your app as a legacy iPhone app.
Not sure how to do this with storyboards but with normal UIViewControllers you would have seperate xib files for iphone/ipad and check which one to load like so:
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.motionJpegViewController = [[MotionJpegViewController alloc] initWithNibName:#"MotionJpegViewController_iPhone" bundle:nil];
} else {
self.motionJpegViewController = [[MotionJpegViewController alloc] initWithNibName:#"MotionJpegViewController_iPad" bundle:nil];
}

Resources