I have a custom UI Button (just regular button but with image), within the navigation bar, but when I choose my image it looks like this in designer:
As you can see here, it's over my provider and status labels, and also when I run application it's over the WebView (which is bellow), so definitely out of navigation bar. I tried to find in storyboard some property where I can adjust this but I couldn't find any. I'm using swift and storyboards.
Appreciate any help, iOS newbie :)
Based on your description I think your issue is that you are trying to add a button for navigation. What you need is a NavigationBar with a NavigationItem/BarButtonItem in it. If you look in the object library you will be able to find these.
Just drag them onto your story board. Once there select the button and in the side menu you will be able to select the Image for that Item. Now it is in the navigation bar up top. Let me know if there are still issues. 👱🏼
You have to make sure your 1x image is to the specified size (and then your 2x etc, or just use a PDF at the 1x size.
Icon sizes are here: iOS Human Interface Guidelines: Icon and Image Sizes
I made my pdf 22x22 and added it to .xcassets with scale factor "single vector"
Related
I am building a universal iOS App. I have 5 icons on the UITabBarController and two of them are displayed incorrectly. They are higher on the UITabBarController than the rest of the icons. I can't figure out what the issue is.
First:
Select your Tab Bar Item in the storyboard.
Second:
Set the insets you want:
Sidenote: (Probably your actual problem)
Make sure your images are correct size in pixels before adding it to your project, to avoid taking up to much space and have the images sticking outside the UITabBar. All your icons should have the exact same height/width when you add them to the project.
I made a "single view" app with a UIView interface in a .xib file. I added a navigation bar at the top with some buttons on it and all worked fine in iOS 6.
With Xcode 5 my navigation bar is too short and buttons overlapped status bar. I tried to add a "top bar" in the "Simulated Metrics" panel but once I run the app the bar does not appear (even if it appears in the .xib file during editing).
Same problem when I tried a tool bar because I need a 64 pixel (instead 44) high blur bar.
Does a simple solution to this problem exist? Thanks!
Simulated metrics, while editing a storyboard and/or xib are, are there for you to use when stubbing out your design. They will not show up at run time. Think of them as fictional representations or a prototype of what you would like to see in your design without actually having to implement it yet.
IE: You're not sure if you want a UINavigationBar in your design. You can layout your design with the UINavigationBar turned on in the simulated metrics and it'll show you what it looks like, but only in the editor not actual run time, and from there you can make your decision on whether or not to keep it or rearrange your other controls. Something like this is very handy if you create your UINavigationBar programmatically (like I do). If I simulate the UINavigationBar (even though I'll create it programmatically) then I can get a much better idea of where to layout all my other controls that I DO setup in IB.
All that being said, if you layout all your xib's and SB's in the interface builder then the simulated metrics really is worthless to you for the most part because you can obviously just drag and drop the control onto your xib.
Hope this helps!
I've been searching SO and Google for a while now with no luck.
What I need to do, is in certain conditions, display a status bar at the top of my application.
When this bar shows, I need to shrink all the other content down so everything still fits on the screen.
I know I can use CGAffineTransformScale, however, I am not having any luck doing it globally for the entire app.
I'm sure I'm missing something obvious. Guess my lack of experience is showing.
Thanks
EDIT: The 'status' bar I'm referring to is NOT the standard iOS status bar. It is a custom status bar that appears only in certain conditions and sits at the top of the app.
I would check your autolayout settings on the first view you added to the controller - if you have them setup correctly then it should resize automatically.
If you use a UIViewController or any concrete subclass of that, its view should automatically adapt to whether or not the status bar is currently visible.
Now in case you use autoresizing masks, your UI should be fine. Same should apply if you use a UIScrollView.
Alternatively: In Interface Builder, select your view controller and on the attributes inspector turn off Layout: Wants Full Screen. Then, your layout will automatically adjust its size to make room for the navigation bar.
When I work with buttons in the storyboard they look good, like this:
But when i run the app they turn out like this:
Do you guys know why?
Here are som settings:
Thanks!
You might have put image in Image attribute of inspector.
Put that image in Background attribute of inspector.
top one in your attribute inspector Type, change that to Custom from Rounded.
By the way, our iOS has simulator not emulator. In android sdk we call it emulator ;)
check the view content mode in the attribute inspector it's in the fourth tab on your right colum. content mode can be scale to fill, aspect fit and a bunch of other possibilities. This will affect how it is presented. Check also in the fifth tab how your button autosizing is set.
I am doing a simple tab based app, with one 2 tab items and I would like to have an image in
each tab.
The problem is, tabbarcontroller is cropping the images rather than fitting them in. I just have two images, basically text, saying "ABOUT","SETTINGS" and i would like them to take the full width of the tab bar. Something like the attached image. How can i achieve this without the images getting cropped.
Referring to the image "ABOUT" & "SCAN QR" are images.
Thanks
I don't think what you wish to accomplish is achievable by using the standard controls.
I'd recommend using a custom toolbar instead of the tab bar controller.