I am asking a very basic question in which I am getting some problem.
I know the difference between the iPhone and iPad …that iPad supports SplitView, popup over but while designing I am getting error.
I have designd a UITextView
UITextView *textview = [[UITextView alloc] initWithFrame:CGRectMake(42, 150, 440, 60)];
this is basic code to design a textview but when I run this code on iPad simulator it seems fine to me. but When I run it on iPhone ,It does not goes well ..because size for that iPhone is different .In that case what should I do to run it well on both iPhone and iPad.
I am assuming that you are opting for a universal executable, so conditional compilation is not an option for you.
When you make a universal executable, you should check the features that you are relying upon before making calls dependent on the device type. In this particular case you are relying upon the screen having a particular size. Instead of hard-coding the “magic numbers” (42, 15, 440, and 60) you should calculate them from the current size of the available screen:
There is a chance that calculating actual sizes from the screen size is not possible, because you do not want your view to scale proportionally to the screen. In cases like that you can check the values of
handw, detect the device size, and use the corresponding set of pre-defined sizes to init your view.