[ios develop]Why does ipad2 camera not full screen? - ios

I am using UIImagePickerController to take photo.The process is :
start a view with some controls.
addsubview on current view:
self.claim.view.frame = CGRectMake(0, 0, 1024, 50);
[self.view addSubview self.claim.view];
3.there is a Button in self.claim.view to start camera and it does start, but the problem is:the vision is only shows in the view area( 0, 0, 1024, 50 ),I can't see anything clear through the camera,why doesn't it fill the screen ?I try several ways but doesn't work.
My tries:
1. set property cameraOverlayView(manual said this property set a view to overlay the preview view.)
2. when press the button add another subview with frame(0,0,1024,768), and in new view delegate method*(void)viewDidAppear:(BOOL)animated**start the camera.
neither of them is helpful.Is there any possible way to make the camera full screen?

I had a similar issue before. It could be the view controller that you're doing your
[self presentViewController:imagePicker animated:YES completion:nil];
instead try to instantiate the imagePicker in another view controller and dismiss the current view controller. Hope this help.

Related

Uitabbarcontroller won't respond on touching on the title of the tabbar in iPhone 5

I'm adding a tabbarcontroller to the main view controller. If I touch the title below the image logo of the tabbar it won't respond. If I click the image of the tabbar, it gets a click and selected. This issue is only iPhone 5(4 inch screen). But it works fine in 3.5 inch device.
Please, refer the below the image, area inside red border won't respond to touch for all tabbars.
Same issue occurs in both device a.w.a simulator. I remember a post with full tabbar click access here in StackOverflow, but can't find it right now. Please suggest a solution for this.
Edit
Based on your comment
I added the tabbarcontroller using, tabctrl.view.frame = CGRectMake(0, 20, 320, 548); [self.view addSubview:tabctrl.view];
You should also initialize the tabBar with window bounds or self.view
or try not setting the view and tabbar will set it itself
Previous Answer
Enable FullScreen for the MainWindow in the utilities inspector
in Main View Controller
-(void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// I assumed that you have created yourTabBarController in View did load
yourTabBarController.view.frame = self.view.bounds;
}

Prevent clicks on view that presented another view via UIModalPresentationFormSheet

I have a view that is presenting another view via
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[weakSelf presentViewController:navigationController animated:YES completion:^{}];
The only problem is that the "main" view that presented that new view, has buttons that can be touched because the ModalPresentationFormSheet doesn't take the full screen. I would like to keep that format, but prevent clicks while the Modal is being presented. I know I could do this this check on every possible buttons, but I am sure there is another way!
if (![weakSelf presentedViewController])
Thanks!
You can put the "new view" as a child view of another view that has full screen and make that "parent view" background color to clear color so you can see the "main view" also. Now you can't click the button cause you are actually clicking the view that is the parent on "new view"
One approach could be to place an invisible 'shield' above the hosting view controller, but below the form sheet.
Basically, create an empty UIView whose background color is clear. Add that as a subview to your presenting view controller just before you make your call:
[weakSelf presentViewController:navigationController animated:YES completion:^{}];
Now, this doesn't necessarily mean such a solution is in good taste. That is, the form sheet style isn't meant to be exclusive in that way, and it can be confusing if the UIView installed above is clear. So, you could reduce the alpha value on that view to turn it into a dimming screen, to help the user understand that the form sheet is the only thing they can interact with at that time:
UIView *dimmingScreen = [[UIView alloc] initWithFrame:self.view.bounds];
dimmingScreen.alpha = 0.5; // play with this value to get different degrees of dimming
dimmingScreen.backgroundColor = [UIColor blackColor]; // play with different colors
[self.view addSubview:dimmingScreen];
// Now present your form sheet, as you were:
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[weakSelf presentViewController:navigationController animated:YES completion:^{}];
You'll want to be able to remove the dimming screen too, so best make it a view controller property you can access so as to remove when needed.

Presenting a view controller of custom size with navigation

I want to present a view controller of custom size say (500,500). I try to do that with the below code, it works fine with a semi transparent light gray background if I present the view controller alone but when i put the view controller in a navigation controller (which I want to do) there is a black background that comes up, I dont want this and I want the gray one.
I did the following code with the help of this question:
iOS -- how do you control the size of a modal view controller?
MyViewController *vc=[[MyViewController alloc]initWithNibName:#"MyViewController" bundle:nil];
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:vc];
nav.modalPresentationStyle=UIModalPresentationPageSheet;
[self.window.rootViewController presentModalViewController:nav animated:YES];
CGRect r = CGRectMake(self.window.rootViewController.view.bounds.size.width/2 - 250,
self.window.rootViewController.view.bounds.size.height/2 - 250,
500, 500);
r = [self.window.rootViewController.view convertRect:r toView:vc.view.superview.superview];
vc.view.superview.superview.frame = r;
Any guess, what I am missing here?? Or is there a easy way to present a custom size VC with navigation??
With navigation:
Without navigation: (i am using a dark background, so it may appear like it is black but it is not)
Just putting transparent overlay on the view controller and present it, sothat it looks like as what you actually want...
Also refer the following link,
Show modal view controller with custom frame in iPad
How to present a modal view controller with custom size in center?
iPad custom size of modal view controller
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

IOS: How to add one image just above Navigation Bar

I want to add a image just above the navigation bar. Here is the final result picture I want:
click me
At the beginning, I think it is quite simple:
Using UIBuilder add one UIImage and one UIView
Add navigation bar controller to UIView as its root view
The Hierarchy I thought should like this: UIViewController->UIView->NavigationBarController.(Here the UIView is one subview of the view of UIViewController)
Below is one of the code I tried, subView is the IBOutlet of one UIView builed by UIBuilder
UINavigationController *test;
test=[[UINavigationController alloc]init];
[[subView window] setRootViewController:test];
[subView.window makeKeyAndVisible];
But after trying several times,I found it is not working.
Does anyone do the same work before? If so, please give me some suggestions.
self.navigationController.navigationBar.frame = CGRectMake(0, //height of imageView//, self.view.bounds.size.width, 44.0f);
CodaFi's suggestion is almost there.
Try this:
test.view.frame = CGRectMake(0, //height of imageView//, self.window.bounds.size.width, //(total height of content... e.g. 460.0f if you leave the status bar visible)-(height of imageView)//);
There is one thing to note though... The navigation controller likes to take up all the usable space on screen so sometimes it will automatically resize its view to a rect like this, {{0.0f,0.0f},{320.0f,460.0f}} after rotating the device. I have experienced this many times on the iPad. You might have to start listening for the rotation event, and reset the frame of the navigation controller's view on every rotation to one that doesn't block your image.

Display Modal View Controller over detail view in UISplitViewController

I have a UISplitViewController in an iPad app. When something is selected from the table I want to fade in a modal view controller over the detail view. I can present it without a problem, but for some reason I can't get it to match the frame of the detail view. I would like it to stick to the detail view controller frame on rotation as well. Does anyone have any experience with this? This is my code to display. The detail view controller reference is set in the app delegate and passed down the table controllers.
QuestionViewController_iPad *questionView = [[[QuestionViewController_iPad alloc] initWithNibName:#"QuestionViewController_iPad" bundle:nil] autorelease];
questionView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
// Not quite
questionView.modalPresentationStyle = UIModalPresentationCurrentContext;
questionView.questionQuizCon = [QuestionQuizConnection firstQuestionForQuiz:quizCatCon.quiz];
// Maybe something like this?
[self.detailViewController presentModalViewController:questionView animated:YES];
When the modal view presents, it matches the size of the detail view controller, but it doesn't but it sits on the top left of the screen behind the master view controller. It also doesn't resize on rotation. I have the springs and struts set to auto size and fill. The height changes on rotation but it won't fill the width.
I couldn't get this to look right any way I tried it so I ended up just using view transitions to make it look like pages being torn off a notebook. That looks better anyway.
// Transition the view on as a subview.
[UIView transitionWithView:self.detailViewController.pageView duration:1.0
options:UIViewAnimationOptionTransitionCurlUp
animations:^ {
questionView.view.frame = CGRectMake(0, 0, self.detailViewController.pageView.frame.size.width, self.detailViewController.pageView.frame.size.height);
[self.detailViewController.pageView addSubview:questionView.view];
// Watch this one
self.detailViewController.currentQuestionViewController = questionView;
}
completion:nil];
After [self.detailViewController presentModalViewController:questionView animated:YES]; you should set center property and/or frame of questionView. Be sure that you set it after presenting modal view.

Resources