Disable the shadow on UIPopoverViewController's content view - ios

I'm creating a custom popover for a UIPopoverController by subclassing UIViewController to manage the content view and UIPopoverBackgroundView for a custom background. Everything works great, except the UIPopoverController is applying a shadow to the content view, making the content appear bordered with shadow. I can't seem to find which view's layer is shadowed. How can I disable this shadow? Has anyone else ran into this problem?

As this is still standing months later, I'll close this by saying I implemented my own popup controller. It's a shame, though, one would think there would be a better way...

Related

In iOS, is there a way to add (overlay) a subview of a UIBarButtonItem image without it moving the buttons already in the bar?

I have my swift 5 app working and I'm now adding a 'tool tips' feature, explaining what each part of the screen does.
The approach I have taken is from an article online - add a subview of grey to dim the background, then to that, add a subview of the item being described again, so it is now highlighted, then also, add a subview of an explainer bubble to explain the item highlighted.
This works fine, so long as the UIView I'm using isn't from a UIBarButtonItem. When it is, the bar buttons underneath the grey screen move around to accomodate what they believe is another bar button being added, which causes everything to miss-align. Other buttons do not have this problem, only UIBarButtons.
Any advice is greatly appreciated. Thanks.
Are you adding the duplicate subview to the bar itself? It'd probably be better to add it to the screen rather than the bar so it doesn't affect the bar's layout. In order to get its frame relative to the view controller so you can display your duplicate in the correct position, you could use:
barButtonItem.convert(barButtonItem.bounds, to: self.view)
Assuming self is a UIViewController.

Fully customising a UINavigationBar for iOS 11

I'm working on a project where the designer came up with the following great idea:
A navigation bar with a height of 175 and a slanted edge. Now I didn't think this would be a problem, but it doesn't seem like I can actually edit the frame and/or mask of a UINavigationBar anymore... Normal stuff like editing the frame, or the bounds doesn't seem to work.
Does anyone have any experience with this? I believe it's an iOS 11/Xcode 9 specific problem.
Thanks.
I am afraid that you couldn't implement the design with the UINavigationBar. You may have to hide the system navigation bar and add a custom view on the top of view controller.
BTW, this design is quite Android-style...
You can't customize native navigationbar like this!.
So, you have to do it with custom view.
If you want this kind of navigationbar in every viewcontroller then,
subclass UIView and set it's all the properties and frame in that class.
Then in your viewcontroller just instantiate that class and add that view(instance) in your main view at top!

iPad UITableView top right corner covered with white box in landscape popover

I am attempting to create a custom popover for an iPad application in landscape orientation. I created a new UITableViewController with static cells on my storyboard and set the size setting to "free form". I then set the size of the UITableView to my desired size. I connected a Modal segue from the parent controller to the new popover.
Then in the parent UIViewController I created a method that performs the segue through a custom presenter. After working through a bug in Apple's orientation handling routines, I got the popover to show at the correct location.
When I run the app, I then discovered that in the top right hand corner of the UITableView a white box is displayed that covers whatever I place in the UITableViewCell. The more cells I place in the table the longer this white box appears. So I believe it has something to do with the UITableViewCell not orienting properly although I have not figured out what yet.
I cannot seem to find what this box is, nor have I had any luck getting rid of it. Has anyone seen something like this? Any help to get this white box remove (or whatever is needed to get the cells working correctly again), will be greatly appreciated.
Thanks in advance
For anyone who is interested, I was able to work around this problem. It turns out that there is a bug in the modal segue logic that does not handle landscape orientation. So I created a XIB and presented that as my modal view. I still need to adjust things since it is landscape but the view displays correctly.
From what I understand this storyboard bug should be fixed soon.

Creating custom implementation of navigation bar

I wish to create a view similar in behavior to the UINavigationBar.
I cannot simply customize the bar as I want the space to be taller and I want to have several other subviews on it other than just UIBarButtonItems. So, I want to be able to create a similar implementation including the floating/translucency effect.
I good example of this is the address bar in Safari in iOS 7. The UITextField on the bar is something that cannot be added on the default UINavigationBar. Nevertheless, the Safari bar still has the transparency.
I do not want it to shrink like it does in Safari when scrolling down, I simply want it to remain just like a UINavigationBar would. I was thinking about adding a subview to the root UIScrollView, but this would scroll along with everything. I want this to remain at the top, but I want other elements to be able to scroll.
How would I go about implementing this?
If you are confident that you can't to this with the default UINavigationBar, you could shrink (from the top) the UIScrollView with whatever the size the custom UINavigationBar is and then add the navbar as a subview to the root view at (0,0) coordinates. It will be independent from the scroll view.
On the other hand, if you need this to be persistent through the application and use it in all of the screens, it will be wise to make some changes starting for the AppDelegate, but that's for another question.
For the iOS 7 transparent-style part, look here: FXBlurView. Best of luck!

UISplitView with UITabbar

I have a strange one that I can not seem to fix. I am currently working on updating my app to iOS7. This all worked in iOS6. It is an universal app and thus uses same xib files. However the iPad uses UISplitViews on some. Like I said, this all worked in iOS6 oh this all works on the iPhone too.
The problem is a grey bar at the bottom. I changed the tab bar to be opaque to move views up properly as i had some UI clipped to bottom of views and that went underneath the tab bar, sidetracked there. But if i set it back to translucent bar, it goes underneath but stretched properly. if i dont, it adds a bar. Other tabs work fine when NOT using splitview.
The UISplitviewController is added programmatically.
See attached image for better description.
This I have tried:
Added autoresize on splitview
Checked xib for subviews in the splitviews to have auto resize
Tried to force splitview to be screen bounds
Removed clips to bounds on all views
Removed autoresize subviews
Any ideas would be welcomed.
Thank you all.
UPDATE:
setting the background colour the uisplitview, it does colour the bar black. So the uisplitview is definitely stretching to it.
I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.
self.extendedLayoutIncludesOpaqueBars = YES;
I believe I have found an alternative solution for you. I have had the exact same problem, mostly because we are both doing something against Apple's Guidelines which is having a SplitViewController nested within a Tabbar controller (SplitView should be the root view). This was okay in iOS 5/6, but now in iOS 7 there are far too many side effects to achieve this.
The reason you see your view stretch completely when you set the bar to be translucent is because the bar is NOT taken into account when drawing the view. When you set translucent to false, it is then taken into account of the view and you will see that grey bar there because that's your view pretending there's a tabbar at the bottom of the screen.
And as always, a SplitViewcontroller's height cannot be changed, as it is determined by the visible window height.
I tried everything you did and then some. The real solution came from using a third-party Split View Controller.
I recommend switching over to https://github.com/mattgemmell/MGSplitViewController . This split view controller is actually one large View with container views living inside of it. Because of this, you avoid all the side effects of putting an actual split view controller within a tab bar.
If that doesn't float your boat, you could create your own solution which follows the same idea of having one UIViewController with two container views contained in it, though the people behind MGSplitViewController did a good job of that already.
This was the only way I was able to solve this issue, let me know if you find an alternative.
Instead of creating a subclass for UISplitViewController, I just added this code on my master's viewDidLoad:
self.splitViewController?.extendedLayoutIncludesOpaqueBars = true
For the controller that is the detail view of UISplitViewController you just do this:
-(UITabBarController*)tabBarController{
return nil;
}

Resources