How to convert an iPhone app to an iPad app - iphone

I am a beginner, and I have an iPhone app.
I want to convert iPhone app to iPad app.
I want to increase the size of all control, images and views according to iPad dimensions programmatically as I have no controls in XIB but in fact they are programmatically made.
I don't want to change the dimensions manually at every place because it is too much of a cumbersome work.
Is there any way I can do this in a better way?

The simple answer is NO.
You have to do it manually. There is no automatic system.
That is the correct answer.
if you have an absolutely trivial app - ie, with no images or controls or layouts! - you can of course just change it to an iPad app.
The questioner is asking specifically how to change all the images, layouts, and so on in a normal app. The answer is it must all be done completely manually. There is no automatic system for re-doing design or re-doing images in Photoshop, etc.
Note that similarly if you want to do both portrait and landscape layouts of an app, you or your designers have to of course simply design both layouts. There's no, say, "artificial intelligence" system that automatically does art direction for the app! You simply have to manually design both layouts and manually build in Photoshop all necessary images for each situation. The same applies to iPad v. iPhone.
(Note that sometimes you will have to do four totally different layouts, and sets of graphics .. for the phone/pad and portrait/landscape.)
This is exactly why iPad apps are sometimes labelled "HD" in the app store - they are of course totally different.

In Xcode, click on your project on the "Groups & Files" sidebar. Press command-I. Search for Targeted Device Family and change it from iPhone to iPad. Then it will compile and run on an iPad but the UI might look a bit funky.
What I did after that was open the xib I used for my iPhone app's FlipSide view (the one that looks funky on the iPad) go to File->Create iPad version and save it as FlipSideiPad.
Then when I load the view controller, I used the following if statement to tell my program to load the iPhone interface if the device is an iPhone or to load the iPad interface if the device is an not an iPhone.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:#"FlipsideView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}
else
{
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:#"iPadFlipsideView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}
I hope that helps.

You need to resize the view manually...there is no such single methods for converting iphone app to ipad

Related

IOS - Load a sub-controller/view into a View

I'm working on an iPad app (actually, converting a iPhone app into iPad app). Since I can put two "Iphone screens" on one "iPad screen" (just regarding the space), I have my iPad view 50% occupied by my original view (loaded through my main controller).
(so far so good)
Now, on the remaining 50% of the iPad view, I want to include another View (for which I have a controller and a view, iphone-sized). I tried to add a "View" component, but how do I load another controller into it ? is that even possible ?
MainViewController loading MyView1.xib
I want to load, in the "View" component, MySecondaryController, loading MyView2.xib
http://imageshack.us/photo/my-images/835/d8fs.png/
Thanks
you can do it something like below...write below code in function which is in Mainviewcontroller(for example on some button tap)
yoursecondviewcontroller *objDate = [[yoursecondviewcontroller alloc] initWithNibName:#"yoursecondviewcontroller" bundle:nil];
objDate.delegate = self;
UIPopoverController *datePopOver = [[UIPopoverController alloc] initWithContentViewController:objDate];
datePopOver.delegate = self;
[datePopOver setPopoverContentSize:CGSizeMake(320,393)];//give any size you want.
[datePopOver presentPopoverFromRect:CGRectMake(50,700, 320, 393) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];//give size and origin whatever you want in FromRect .....
You can also define UIPopoverController object in .h file....
and don't forget to set delegate of UIPopoverController that is UIPopoverControllerDelegate
Let me know it is working or not!!!
Happy Coding!!!!

Converting an iphone application into an iPad , iOS?

I currently have an iOS iPhone application.
What i want to do , is make it universal so that i can target the iPad too.
What i did , was go to the target and change the iOS application target , from iPhone to universal.
Now when i run the application on my iPad , it automatically resizes all the views for the iPad.
However there are some views , with background pictures that dont look so good , cause i need to use higher resolution pictures or in general i should change some things in the iPad version.
Where are the iPad .nib files??? I mean , i only see the iPhone ones. When i run it on my iphone , these files are used. When i run it on my iPad everything is resized correctly , but where the hell are these .nib files?
The tutorials (pretty old) that i read , suggested that when you target the iPad too , new .nib files should be created exact copies for the ipad. Why i dont see these files?
You can have iOS automatically load the right xib based on the extension, akin to how Retina graphics work. If your xib is named Awesome, and you want to convert it into having an iPhone and an iPad version (instead of being shared, rename it such that:
iPhone version:
Awesome~iphone
iPad version:
Awesome~ipad
Then, when you tell iOS to load Awesome, it'll pick which one to load based on the current platform automagically. No need for if statements in your code! You can still if you want, but it's not required.
Note: You might need to perform a clean after the rename! Sometimes some files stick around in the build when renamed.
You will just need to make new .xib files and set them to the same class and you can init that viewController with a condition:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
yourVC = [[YourViewController alloc] initWithNibName:"YourViewController_ipad" andBundle:nil];
}
else
{
yourVC = [[YourViewController alloc] initWithNibName:"YourViewController" andBundle:nil];
}
Whenever possible you should try to use the same .xib but in a lot of cases it isn't possible to do that and look good so you just make a second. Xcode won't do it automatically for you.
Let's say that you have a class. We'll call it Two.
Here are the current files that make up the Two class.
Two.h
Two.m
Two.xib
Two.xib contains a UIView sized for the iPhone. In order to make a view sized for the iPad, you should create a new XIB file (name it Two_iPad.xib), connect the XIB to Two, resize the UIView in Two_iPad.xib for the iPad, and design accordingly.
When you are creating a new instance of Two, do the following.
Two *two;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//they are using an iPad
two = [[Two alloc] initWithNibName:#"Two_iPad" bundle:nil];
} else {
//they are using an iPhone/iPod Touch
two = [[Two alloc] initWithNibName:#"Two" bundle:nil];
}
You are creating a new instance of Two; however, you are checking which device the user has, and using the corresponding XIB file.

iOS - Converting iPhone Build to iPad

I have a application that I built that was to be build as an iPhone-only application.
Now, I am told that the application has to be made universal now. I will have to make it iPad compatible too (in portrait-only mode). I have been looking for my options right now as the XIBs in this project are heavily loaded with objects so programatically assigning co-ordinates will be a pain.
I am looking for the best, and the quickest approach I should take to make this iPhone app into iPad-compatible app as well.
PS: There is no mainwindow.xib file as the application was built with XCode 4.3 which doesn't create the MainWindow.xib file.
Thank you in advance.
EDIT: I have made duplicate XIBs for iPad for all the XIBs. Now, I am trying to use the naming convention which tells me to change the filename suffix to MyiPadXIB~ipad.xib and when the app is run on iPad, it will automatically take that XIB. This doesn't seem to be happening.
When I open the application in iPad, only a small window appears (the window that appears when iPhone-only app is run on an iPad).
Any solution to this?
I followed a very easy approach where I would just create duplicate XIBs of all the XIBs by doing Build settings > target (iPhone)> right click and choose duplicate.
I would then change the name of the duplicate xibs in this format: "iPhone XIB name"~ipad.xib.
The system would then automatically pick up the XIB according to the device used.
From what I know (there may be a quicker/better approach that i dont know of)
You would create seperate xib files for the ipad
when you init your view controller you check to see what device you are on like so
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.serverSettingsViewController = [[ServerSettingsViewController alloc] initWithNibName:#"ServerSettingsViewController_iPhone" bundle:nil];
self.motionJpegViewController = [[MotionJpegViewController alloc] initWithNibName:#"MotionJpegViewController_iPhone" bundle:nil];
} else {
self.serverSettingsViewController = [[ServerSettingsViewController alloc] initWithNibName:#"ServerSettingsViewController_iPad" bundle:nil];
self.motionJpegViewController = [[MotionJpegViewController alloc] initWithNibName:#"MotionJpegViewController_iPad" bundle:nil];
}
And load you iphone or ipad xib file (FYI make sure the xib views are large enough for the ipad)

Adding iPad XIB/VIEW to a "View Based Application" in iOS 4

I've created a View Based Application in XCode4 and trying to do the code and UI design according to the way Apple have intended it to be.
So I designed the UI in the AppNameViewController.xib and it works fine; now I want to enable it as a UNIVERSAL application that runs on iPad as well. I changed the App-Target>>Summary>>Devices from iPhone to Universal and miraculously XCode had automatically created MainWindow-iPad.xib (Apple, very nice...), but since I designed the application first screen on the AppNameViewController.xib and not on the MainWindow.xib when I run the app on iPad Simulator I get this ugly screen where my UI objects size and location is distorted (their size is still set for iPhone so they are all crumbled on the left-top corner of the screen).
In my previous app I used the code appearing below to distinct between the AppNameViewControllerForIPHONE.xib and the AppNameViewControllerForIPAD.xib; It was done from the AppDelegate.m file, but in the new XCode View Based Application template the AppDelegate doesn't go through initWithNibName method at all.
Code I used on XCode 3 that cannot be used on XCode 4:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
viewController = [[AppViewController alloc] initWithNibName:#"AppViewControllerIPAD" bundle:[NSBundle mainBundle]];
}
else {
viewController = [[AppViewController alloc] initWithNibName:#"AppViewControllerIPHONE" bundle:[NSBundle mainBundle]];
}
Long question... still, anyone had any idea how it should be done here? Where should I design the iPad UI or is there a way to easily transform the iPhone xib to an iPad one?
You have to follow the new naming scheme (idiom in Apple-speak) specified for Universal Applications for the NSMainNibFile key in your info.plist. For example, if you set your NSMainNibFile to be "MainWindow-iPhone", the xib for ipad would be "MainWindow-iPad".
The same naming convention should hold for the views in a view based application (I can't test right now, installing new xcode).

iOS4 ABNewPersonViewController Loses Data Entered when attempting to add a Photo iPhone 4

I have implemented a basic add contact feature to an iOS 4 application. Following the documentation from Apple, I have created a navigation controller, and set its root view to the ABNewPersonViewController. I have implemented the delegate as well. The basic mechanics all work.
The problem I am having is when you add a photo to the new person that is very large (taking a photo or picking one from the library), the ABNewPersonViewController form returns empty when the camera controls are dismissed. No photo is in the add photo box either. If I pick a small image (say a screenshot from the iPhone), everything works. I can see from the debug output: Received memory warning. Level=1
Has anyone else run into this? Is there a way to set the photo quality to a lower setting for the ABNewPersonViewController? Any help appreciated.
ABNewPersonViewController *abNewPersonView = [[ABNewPersonViewController alloc] init];
abNewPersonView.newPersonViewDelegate = self;
UINavigationController *newNavigationController = [UINavigationController alloc];
[newNavigationController initWithRootViewController:abNewPersonView];
[self presentModalViewController:newNavigationController animated:YES];
[abNewPersonView release];
[newNavigationController release];
If ABNewPersonViewController does not handle memory warnings correctly, file a bug with apple.