Push viewcontroller like bottom to top with transparent background - ios

I want push view like bottom to top and push view background as transparent
like below image
Thanks

if your project iOS deployment target is above 15.0 then you can use UISheetPresentationController to achieve this. but if you need more customisation you can present a view controller and set background color as you wish like..self.view.backgroundColor = UIColor.black.withAlphaComponent(0.35)
then you have to add another UIView as a subview and add a UIPanGestureRecognizer to it, while gesture change you can change topConstraint.constant according to the touch point. by this way also you can be able to achieve this.

// you can check with this and choose your desired presentation style
viewController.modalPresentationStyle = .yourPresentaionStyle

Related

Change separator colour in UIAlertController action sheet (iPad)

I'm programming a UIAlertController for a popover on the iPad. I know you can set the background colour of the ActionSheet like this:
myAlertController.popoverPresentationController?.backgroundColor = myColour
And you can set the text colour of the buttons like this:
myAlertController.view.tintColor = anotherColour
What I'd like to do though is set the colour of the horizontal separators between UIActions. I have looked at the popover's subview hierarchy and I can see that, internally, it uses a UICollectionView.
So how would I change the separator colour, be it:
a hacky way via the subview hierarchy? Or, preferably,
an official way that I can't see in the docs?
Thanks
There is no available property for UIAlertViewController for customising the separators
You have to go through the subview hierarchy

Achieving iOS 7.1 UINavigationBar blur

I have another UIView under the navigation bar like this.
I want the slight blur of the navigation bar for that UIView too. Currently I have its alpha value reduced but it doesn't give the desired effect as you can see.
How can I get the frosty look of the navigation bar for the UIView as well? I'm on iOS 7.1.
Don't use a UIView - you will never achieve a consistent result with the navigation bar.
Use a UIToolbar and place it below the navigation bar. Set the delegate of the toolbar to your view controller and implement positionForBar: to return UIBarPositionTop or UIBarPositionTopAttached. You can then add all the subviews you have in your view to the toolbar.
you can use UIToolbar, it's the quickest way.
If you want to customize it, you have to use 3rd library like ILTrasparentView, FXBlurView ...

How do I achieve a navigation bar like the one used in iBooks?

The navigation bar in iBooks is exactly what I'm looking to implement. That is, a transparent top bar with the return button in the top left and some buttons in the top right to invoke actions.
However, I'm not exactly sure how this effect would be accomplished. The transparency especially. Can anyone point me in the right direction of how I might accomplish this?
Use a custom UIView subclass. Just add some buttons and set the alpha of the view. Use the controller's UINavigationController to push or pop controllers.The navigationbar should be hidden.
I would not use a navigationControllerBar, I would use a simple UIToolbar to do this. Especially you can have only two button on the navigationControllerBar (left and right button) unlike on a UIToolbar.
The UIToolbar is absolutely customizable, you can set the opacity to 0% and the opaque to NO, after it can be transparent....
With UIView or UIToolbar the alpha is fully customisable. You should subclass one of those two (UIView or UIToolbar), add your buttons and then go from there.

Creating a custom UINavigationbar for iPad in iOS 5 with ARC

I am creating an iPad application for ios 5 using arc and storyboard in xcode 4.3. I need to customize the UInavigationbar to make it broader than its usual size (almost double sized) and add to it some custom logos (images) and buttons. Can anyone pls point me in the correct direction on how this can be acheived? any third party libraries are also welcome if required.
Thanks in advance for your help on this one.
To start, you'll want to subclass UINavigationBar. While it is possible to change the height, the UINavigationBar background isn't going to play nicely, so you'll probably want to use your own background image.
Here's some information about resizing the navigation bar
Change the height of NavigationBar and UIBarButtonItem elements inside it in Cocoa Touch
iPhone - How set uinavigationbar height?
And another article on how to add the images and buttons as subviews.
http://www.iosdevnotes.com/2011/09/custom-uinavigationbars-techniques/
I don′t know how you would change the size of the UINavigation bar.
To add custom buttons you can outlet your navigationItem in the storyboard to the interface of your view controller. Then use setLeftBarButtonItems: and setRightBarButtonItems: to put multiple buttons you previously created.
To add custom black and white logos to the buttons you can use [navigationButtonItem setBackgroundImage: yourImage].
If you want your logos in color you can create a UIButton with the colored logo ([newButton setImage: yourImage]) and then init your navigation button item with : initWithCustomView: newButton.

Can I draw the background of a UINavigationBar as the background of my custom view?

I have a custom view which I would like to look like a UINavigationBar. Is there a way for me to draw the background the same way a UINavigationBar would?
I don't want to draw an image or a gradient fill that looks like a UINavigationBar - I want to use the same library code (if it is public) that a UINavigationBar does to draw its background.
The drawRect: method of a UINavigationBar is private - you can't use it to draw the background of your own view.
The easiest way round this would be to take a screen shot, trim the image to nav bar size, add to your project, and then either draw the image in your view's drawRect: method, or add a UIImageView as a subview of your view.
Alternatively, would it be possible to use a UIToolbar instead of your custom view?
You could set your view background image and just use an image that has the navigation bar look already filled in.
As far as tapping into whatever the navBar uses to create itself, you are probably out of luck unless you just build a navBar into your app. Otherwise you would end up having to build a custom view at the top of your app, draw everything in manually. At that point, you are probably better off implementing the navBar.

Categories

Resources