0

In my iOS app i present standerd controllers MFMessageComposeViewController and UIImagePickerController.

But they both presenting with strange navigation bar.

enter image description here

enter image description here

enter image description here

How can i fix this problem?

UPD code for presenting controllers

UIImagePickerController:

UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
    cameraUI.sourceType = sourceType;
    cameraUI.allowsEditing = YES;
    cameraUI.delegate = self;
    [self presentViewController:cameraUI animated:YES completion:nil];

MFMessageComposeViewController:

MFMessageComposeViewController *messageViewController = [[MFMessageComposeViewController alloc] init];
    if([MFMessageComposeViewController canSendText]) {
        messageViewController.view.backgroundColor = [UIColor whiteColor];
        messageViewController.messageComposeDelegate = self;
        recipient= [NSStringMask maskString:recipient withPattern:@"\\+(\\d{1}) \\((\\d{3})\\) (\\d{3})-(\\d{2})-(\\d{2})"];
        messageViewController.recipients = @[recipient];
        messageViewController.body = body;
        [self presentViewController:messageViewController animated:YES completion:nil];
    }
Eugene Trapeznikov
  • 3,220
  • 6
  • 47
  • 74
  • What exactly is strange about it? Have you read https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/ – Popeye Oct 14 '13 at 09:24
  • @Popeye, you can see strange lines on bars. and in MFMessage table with bubbles not sizing in all view – Eugene Trapeznikov Oct 14 '13 at 09:30
  • It's not a strange navBar. It's just that since the new statusBar is transluscent the view start at the top of the screen (and not 20). And Im sure that the grey line is a view with a frame like that : `(0, 40, 320, 1)` – KIDdAe Oct 14 '13 at 09:31
  • @KIDdAe ok, i add `[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];` before calling this controllers. but still not working – Eugene Trapeznikov Oct 14 '13 at 09:37
  • I believe `KiDdAe` is correct that the line is the top of the initial view for that view controller. You need to have the `y` position start 20 pixels further down the screen if on iOS7 device. – Popeye Oct 14 '13 at 09:39
  • @Popeye i understand it. but how? could you give me sample code. i can't change view's frame, because this is not my controller – Eugene Trapeznikov Oct 14 '13 at 09:44
  • Please provide code for how you are currently doing your thing. – Popeye Oct 14 '13 at 09:46
  • @Popeye see it un update. But it is really basic way to do it – Eugene Trapeznikov Oct 14 '13 at 09:53
  • Can you not just do something simple like `[[cameraUI view] setFrame:CGRectMake(0, 0, 0, 0)];` obviously replacing the `0`s with your dimensions and do the same for `messageViewController` or try doing `mashdup`s answer if that doesn't work. – Popeye Oct 14 '13 at 09:57

2 Answers2

2

In iOS 7, the status bar and the navigation is translucent by default. To make the view act 'normal' like in iOS 6. you need to add this to the controller you are presenting.

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
        self.edgesForExtendedLayout = UIRectEdgeNone;

If you want to read up more about changes in views. Check out this post. I find it a nice quick overview whats changed.

http://www.brianjcoleman.com/ios7-weve-got-a-problem/

mashdup
  • 875
  • 7
  • 18
  • that's sound good for customs controllers. but i use Apple's controllers. I try to inherit from UIImagePickerController. Add this code, but nothing change. – Eugene Trapeznikov Oct 14 '13 at 10:55
  • you can put it when you create the instance. so replace self with cameraUI. so if([cameraUI respondsToSelector:@selector(edgesForExtendedLayout)]) cameraUI.edgesForExtendedLayout = UITectEdgeNone; – mashdup Oct 14 '13 at 11:12
  • nothing help. maybe something in plist?? or.. i don't know (( – Eugene Trapeznikov Oct 15 '13 at 05:40
1

See this question. I used the second answer, though I suspect the first would work for me also.

Community
  • 1
  • 1
T.J.
  • 3,942
  • 2
  • 32
  • 40