How to show UIButtons present on the view controller - ios

I had a UIViewController on whose view I had started an AVCaptureSession and added two UIButtons to capture photos and close the camera,
I was facing the issue that the AVCaptureSession was also getting rotated when I was rotating the device,
To solve the problem I followed the second answer on this link,
<https://stackoverflow.com/questions/7353789/ios-disable-autorotation-for-a-subview>
But after adding on the window if I am making the view on the window of the full width and height as the self.view I am not being able to see the buttons
Any suggestions how I can bring the buttons visible while adding the window view as full width and height as the view of my view controller.

You will probably have to create a subView of the "full width and height" view that you have created, and put the buttons over there (instead of in self.view).
Edit:
You might also try calling bringSubViewToFront on both buttons.

Related

How to make viewcontroller as popup

I have created ViewController which has 0-0-0-0 constrains from superview.
And I recently got a task make this ViewController like a popup as shown in picture.
As you can see this white background which is my ViewController has some margins from left-right-top-bottom and shows some part of other ViewController.
How do I create this view in a quick way?
If you have given constraints in storyboard and not by programmatically, Then at the time giving constraints if the set to margin checkbox is checked, then possibly you have this space, which default margin to the screen.. :)

UIView inside UIScrollerView displays with -64 offset

I'm trying to create a form that will be larger than the screen size and I've decided to use a view inside a scrollerview, then I'm adding the rest of the UI widgets (textfields, buttons, etc.) inside the view.
The view displays and scrolls, but no matter what I try, it displays with a vertical offset of -64 below the navigation controller bar. Once there the view will happily scroll up down.
I want the view to anchored at the top, just below the navigation bar, and then scroll down.
I am using IB.
Lots of time researching and not many answers that have worked for me. UIScrollView seems to be like one of those dirty secrets the whole iOS world seems to avoid....
Thank you for your help.
You can fix this in the storyboard
1- Select the view Controller
2- GO to attributes inspector
3- Uncheck adjust scroll View insets
For your view controller, in the storyboard uncheck the option to extend edges under top bar.

My app's main view doesn't resize to fill the screen when the device is rotated

Recently I ran into an issue with my app when changing the device's orientation.
This is my main ViewController (let's call it VC1) in portrait mode:
Now if you push / present any viewcontroller (let's call that VC2), rotate the screen while in VC2, and return back to the previous view (VC1), this is what I get:
Why doesn't VC1 rotate correctly like it should? This issue happens throughout the whole app and with any two views. I honestly have no idea what might be causing this or where to look, so any help would be appreciated.
Do you use constraints and autolayout? Can you post a screeen where constraints of the view are visible? I think there are some missing constraints
your navigation bar is properly resize in portrait and landscape mode So The main problem is you didn't add trailing Constraints to your view.
Just Add you trailing constraints on your view in Storyboard.

Weird scrolling behaviour when using Tab Controller - iOS

I am building an iOS app using Swift. In my app, I am using a paging menu controller (called PageMenu) built from other view controllers placed inside a scroll view (you can view it on GitHub here). It is similar to how Instagram looks:
When I set up the PageMenu in my project, it looks and works great...
BUT, when I embed the view within a Tab Bar Controller to add in a normal iOS Tab Bar, the scrolling within the PageMenu view doesn't work...and I get weird diagonal scrolling, and I can't actually scroll down if there is more content.
Does anyone have any idea of why this might be happening and how to fix it?
Please ensure that you set up the frame size when you are initializing the page menu.
If your scroll view is bigger than the actual view, then you will only be able to scroll the view, and not scroll the content inside it properly.
Set up the frame size of view while embedding. Check the parent view frame size.

tab view like button slides up

I am trying to have a button that is located on the bottom and when the user taps on it it will slide up to show the menu. How is this possible using code or is there an api or anything that I can use to make this possible in the easiest way?
Your screenshot shows a view whose frame is animated when the button is pressed so that either the height of the view, or more likely just the position, is changed so that the view becomes visible. This is a simple UIView animation and the view being added so it is hidden behind the button initially.
Check out the iOS documentation for Animating Views https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html
You should be able to create the view and its content either with the interface builder or in code. Start with the view off the bottom of the screen and then use animateWithDuration:animations: using the frame property.

Resources