blank space above the bar? - ios

I have a iphone app which is installed in iPad its UI(blank space about 20 pixels above navigation bar) is correctly displayed in ios6 while a blank space appears in ios7 in iPad.
I tried using the default images and using the methods
- (void) viewDidLayoutSubviews {
if (([[UIDevice currentDevice].systemVersion floatValue] >= 7.0)) {
CGRect viewBounds = self.view.bounds;
viewBounds.origin.y = -20;
self.view.bounds = viewBounds;
}
}
but no use.How do i fix it? It is not a universal app.

The problem is related on the way iOS7 draws the views, please rewfer to these guide to understand the problem:
Explaining difference between automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout in iOS7

Related

It is not possible to set size from iPhone to iPad Full Screen

I developed an iPhone app and want to extend this app for the iPad. Therefore I copied the XIBs and changed the document type from com.apple.InterfaceBuilder3.CocoaTouch.XIB to com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB and named the XIBs as follows: "UIFile.xib" as "UIFile~iPad.xib" …
Now I tried to change the size from the views inside the attribute inspector from "iPhone" to "iPad Full Screen". It worked for the launch screen, but not for the localized XIBs. I can change the values directly in the source code, but it has no affect for the graphical view inside the Interface Builder. They just have the same sizes as for the iPhone XIBs. Now it is difficult to place the view components like buttons at new position.
How can I resize the View to "iPad Full Screen"?
You can use in each class
- (void) viewDidLayoutSubviews
{
if ([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPad) {
CGRect viewBounds = self.view.bounds;
CGFloat topBarOffset = self.topLayoutGuide.length;
viewBounds.origin.y = topBarOffset * -1;
self.view.bounds = viewBounds;
}
}
Think I have to use the Size Classes. After activating the Size Classes it is possible.

Views in iOS7 moved above Navigation bar but work fine in iOS6

I am unable to get the UISearchBar to display fine on iOS7. I cannot use AutoLayout as I must support the app for older versions of iOS prior to 6 also. I tried setting the container view's frame if the iOS is of version 7 and above but it does not work. I also tried topLayOutGuide length and other tips mentioned in other SO posts but I could not succeed. (EDIT:- I am using STORYBOARD)
The only thing I currently have in my code is
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(#"7.0")) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
Can someone please help me with this issue?
I try to suggest a change to do in the storyboard:
tap on your viewController and on attributes inspector uncheck Under top bars
if this not work try this code:
-(void)viewWillAppear:(BOOL)animated {
NSString *ver = [[UIDevice currentDevice] systemVersion];
int ver_int = [ver intValue];
if (ver_int < 7) {
}
else {
self.navigationController.navigationBar.translucent = NO;
}
}

My app does not support Portrait mode but at times it turning into portrait mode

My app does not support Portrait mode but at times it turning into portrait mode. I am using Xcode 5.02 & I am running my app on iOS7. I unchecked the portrait mode in the settings so that it does not support portrait, but at a point of time it is turning into portrait, I dont have any clue, any one to help me out, my app is master-detail base. This below code snippet in app delegate & dashboardNavController is UINavigationController
self.window.rootViewController = self.dashboardNavController;
[self.window makeKeyAndVisible];
if needed I am glad to provide more informations, Thanks in advance
Try this in ViewDidLoad
CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI/2);
self.view.transform = transform;
// Repositions and resizes the view.
// If you need NavigationBar on top then set height appropriately
CGRect contentRect = CGRectMake(0, 0, self.view.size.height, self.view.size.width);
self.view.bounds = contentRect;

How to adjust UITableview margins from left and right programmatically?

i have a tableview(no table view cell). My Application is running fine in iOS 6 but when i am running it in iOS7 Tableview margin is conflicting.When i am setting up frame via Code its margin is only adjusting from left and bottom. i am using following code
if([[[UIDevice currentDevice]systemVersion]floatValue]>=7){
CGRect newSize = CGRectMake(0,0,730,925);
newSize.origin.y = 0;
newSize.size.width = 728.0;
newSize.size.height = 925.0;
self.myTable.frame = newSize;
}
Please suggest me something how can i resolve it
?
Here are images for ios 6 & ios 7 (Its a group table view ) i havent changed any margin for ios 7 its same as in ios6 ,and if i am doing any changes in ios 7 regarding margin its affecting in ios 6 layout too..
Add autoresize property
//ensure autosizing enabled
self.view.autoresizesSubviews = YES;
myTable = [[myTable alloc]initWithFrame:self.view.bounds];
[myTable setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
[self.view addSubview:myTable];

UIStatus Bar Color issue

For showing status bar in iOS 7 did the following code :-
- (void) viewDidLayoutSubviews
{
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(#"7.0"))
{
CGRect viewBounds = self.view.bounds;
CGFloat topBarOffset = self.topLayoutGuide.length;
viewBounds.origin.y = topBarOffset * -1;
self.view.bounds = viewBounds;
}
}
As you can see in the image status bar color changes for both iOS Simulator 3.5 inch (iPhone 4/4s) and 4 inch (iPhone 5) .I want to show my status bar color white in 3.5 inch screens also. So, Please help me out from this issue.
Thanks in advance.
Go in your PLIST, and add this flag:
View controller-based status bar appearance = NO
next, in your AppDelegate in didFinishLaunchingWithOptions add this:
[[ UIApplication sharedApplication ] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES ];
after checking if your device is ios7. UIStatusBarStyleLightContent is new.
Hope this helps.

Resources