I have setup my project to mimic the SideMenu example project to the best of my abilities, but the background image for the sideview is
not displaying properly. I would like to only have underlines under the cells that I setup, not have a title bar and have the background image stretched across the sidemenu, not repeated several times. I am fairly weak on storyboarding, so if there is any info you need to help with this, please let me know. I have gone through all of the attributes settings I could and can't seem to find anything else helpful.
I have included a picture of the look I want to achieve, my current app and my current tableview in the storyboard interface
Below is my code showing how I am setting up the side menu background image.
SideMenuManager.default.menuLeftNavigationController = storyboard!.instantiateViewController(withIdentifier: "LeftMenuNavigationController") as? UISideMenuNavigationController
SideMenuManager.default.menuAnimationBackgroundColor = UIColor(patternImage: UIImage(named: "sidemenubackground")!)
// Enable gestures. The left and/or right menus must be set up above for these to work.
// Note that these continue to work on the Navigation Controller independent of the View Controller it displays!
SideMenuManager.default.menuAddPanGestureToPresent(toView: self.navigationController!.navigationBar)
SideMenuManager.default.menuAddScreenEdgePanGesturesToPresent(toView: self.navigationController!.view)
I am trying to achieve this look. My current view repeats the background image repeatedly, has a title bar on the top and has underlines under nonexistent cells:
This is what my side menu looks like currently:
Here is what my tableview looks like in the storyboard currently:
Related
The buttons are still there and function fine, however as you can see they are completely invisible. Adjusting font colors and navigation bar colors had no effect. I have been trying to resolve this for months and despite reading Apple's documentation, I am unable to even see where you would change what I assumed to be a system wide function.
So to help narrow down this issue I created a simple navigation controller with a print button. If I put these both on the Login storyboard (the first storyboard) it works perfectly fine. If I put it on Main.storyboard (the second storyboard) it doesn't work.
If I change my project settings to make Main.storyboard the first storyboard it works. Leading me to believe the issue is in my FirstViewController.
You can set the color of the print and cancel button
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UIToolbar.self]).tintColor = UIColor.green
After narrowing down the problem to the first view controller I discovered the tint was set to Clear Color (ie Alpha is 0). Fixing this resolved the problem in the rest of the app. I am surprised a setting in a view can propogate to the rest of the app and overwrite all of the other views in the process. Perhaps apple set the first view to determine the colors for system pop ups etc.
I searched this question many times but couldn't get enough information.
So I will use UIButton or UIView to replace UITabbar for customizing issue.
I want to put divider(separator) between two tabbarItems and bottom lines like the image below
But What I made now is below:
How can I make it as I want?
I did customize many view components(UIViewcontroller, UIButton, UITextfiled,UITableViewCell,UICollectionViewCell) but I don't know how to customize tabbarItem
I'm afraid there is no specific option to set a divider in UITabBar. But you can always use a custom tab bar. You can check this out, it has a special property for seperator image:
NMBottomTabBarController for iOS
There is also another option. You may like this :) I also used it myself in one of my app. I made an image that looks like a tab bar with seperator as a background image. Then put the items on it. Easy peasy. For example check this image:
Image Link
I hope this helps.
I am working on an application using Swift which needs to have a TabBarController and when user will select a tab then that particular tab bar item shows a 3d visual effect (Although it will be an static image I guess) which contains shadow and that tab bar item will be bigger in size as well with different tint colour.
Please see the attached image.
I have searched a lot on internet but no luck. Please someone help :(
Use http://cocoapods.org/pods/M13InfiniteTabBar
For as much as I do not like answers in the tone It can't be done, I feel that the specific of your screenshot, namely going outside of the UITabbar background, can't be done with UITabBarController.
You can use -initWithTitle:image:selectedImage:. Documentation found here
I have implemented a simple Table View Controller with a Search Display Controller dragged out via Interface Builder. I then enabled refreshing so that a Refresh Control is visible when the user pulls down to refresh.
The problem is, the spinner is visible on top of the search bar when it should lie underneath it.
I know the cause is the Minimal Search Style. If you use the default Prominent style, the issue doesn't exist.
When you slowly pull down you'll see the first line appear overtop the search bar like so:
If you keep pulling it does show up in the location you expect, but if you push the view back up while it's still refreshing you'll see the spinner on top of the search bar like so:
As soon as you push it up so that the spinner touches the first section header, the spinner immediately disappears.
This is how it is supposed to look, like it does in Mail - underneath the search bar:
I tried to fix the problem by simply making the spinner lie underneath the search bar so that it would never appear overtop, but that did not work. Oddly enough, that code caused the spinner to not be visible in the gray area above the table and if you push it up it appears overtop the search bar - exactly opposite of what I would expect. Here is that code:
self.refreshControl.layer.zPosition = self.searchDisplayController.searchBar.layer.zPosition - 1;
How can I prevent the spinner appearing on top of the search bar when using the Minimal style?
To workaround this bug for UISearchBarStyleMinimal, you have to set backgroundImage property with any image. Only if background image is set, layout behave correctly.
private extension UISearchBar {
private func setBackgroundColorWithImage(color: UIColor) {
let rect = self.bounds
UIGraphicsBeginImageContext(rect.size)
let context = UIGraphicsGetCurrentContext()
CGContextSetFillColorWithColor(context, color.CGColor)
CGContextFillRect(context, rect);
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
self.backgroundImage = image // here!
}
}
This seems to be a bug with the Minimal Bar Style. If you set it to Prominent you won't experience the issue. If you use Prominent and try to remove the background, you'll also experience this issue. The only workaround I've found is to try to mimic the Minimal style with the Prominent style applied.
Move the refresh control behind the search bar when you set it up.
refreshControl.layer.zPosition -= 1
So if it helps anyone i had the same problem and a fast solution is adding the refreshcontrol as a subview of self.view instead of tableheaderview. This will add the controller above every thing else and at leas you'll be able to see it. On the other hand i believe you could fully corrected y setting it under the correct layer.zPosition. But i haven't had time to fully correct it.
[self.view addSubview:self.refreshControl];
I have a working IPad App. I built everything on a default white screen and I want to add an image to background of the image. I read a couple of articles and most of the suggest to create a new UIImage with the background image and stretch it to the full screen. I tried that but I am using a couple UIImage to display the photos taken and my UIImage s seem to stay at the back of the background and they don't get shown.
What is the proper way to set the background of IPad App?
this is the screenshot of my IPad App
Follow these steps :
1) Add UIImageView to your UIView.
2) Fill it with your Background UIImage.
3) Select your Background UIImageView and Select "Send to Back" Option....
The key is your view hierarchy. If you do not want to hassle around with moving the subviews along and sendings ome to back and some to front, then start with a proper view hierarchy from the beginning.
Basic rules are: the subviews overlay their superviews.
If siblings overlay each other, then the last one added is shown.
Your view hierarchy could be:
\UIView (A: the underlying self.view from the view controller's point of view.)
\UIImageView (B: the view for your background image. Empty or hidden from start.)
\UIView (C: Container for all of your views, no background color, no background image)
\UIImageView (C1: One of your picuters)
\UIImageView (C2: One of your picuters)
\UIImageView (C3: One of your picuters)
\UILabel (C4: One of your labels)
\ ...
Build up your view hierarchy. And when you need to add or change the background then assign the appropriate UIImage ot the View B.
Certainly, there is more than one way to achieve this. However, I personally thinkthat some proper view hierarchy works best, regardless whether you do that in IB or programmatically.
The proper way is to create a UIImageView and set it to the size of your view, and put all the others View in fron of it. The tutorials that you read are giving you the right way.
If you do not want to add an image, only a color you can set the background color of your view to this color.
You can use this code to send the ImageView to the back:
[self.view sendSubviewToBack:YouBackgroundImageView];
EDIT
Because you posted and XIB screenshot:
Your background image view must be in the first position, like this image: