in my app i use a navigation controller and a tabBar for my views. The problem is that the titles that i have for the views are a little too long to fit.. they appear like in the photo below.
alt text http://img17.imageshack.us/img17/1524/picture2usx.png
could someone give any suggestions for resolving this problem? i tried subclassing UITabBarItem but i can't add a label as a subview, i can't change the font or size.. it looks ok when i have only 4 buttons but that is not ok because i need that more button. cutting down the names is not an option either, i don't think apple would like that.
thank you in advance.
As far as I can tell, there is no way to do what you want to do easily.
You could build some of the name string into your icon image. This will of course force you to internationalize your icon images, and you will also end up with the blue coloring in some of your text.
You could have no titles at all, and overlay your font-scaled title by drawing on the containing view. Note that when there is no title in the tab bar item, the following page will also have no title in the title bar.
Better by far, if you can do it, is to shorten the names. I know this is tough in German, but surely there must be alternatives.
I hope that Apple improves this in 4.0, but as those fonts are already fairly small, I sort of doubt it.
Related
So I'm working on an app but I'm pretty new to Xcode and swift itself, so thats what i have right now [textview color is just to show you its size]
http://i.imgur.com/55fC4Fb.png
But this is what I want:
http://i.imgur.com/VA1hZqO.png
i thought using top and bottom layout guides would help, but I'm totally lost. If anyone could help that'd be amazing! :)
I'm sorry, but i am new to this :/
One simple way to do this is to drag the text view between nav bar and tool bar, and then pin its top and bottom edges to nearest neighbors (in this case, nav bar and tool bar), like this:
http://i.imgur.com/7CADxPh.png
NOTE: make sure its edges are in between bars, not overlapping them. Also uncheck the Constrain to margins -box.
I got it to look like this very quickly:
http://i.imgur.com/AfksPdQ.png
There are many other ways to do this, and this is just one of them. Search for storyboards tutorials and you'll find many good tutorials how to use Interface Builder. :)
I have a UITabBarController as my rootController with 8 UITabBarItems. and I want to show just 4 UITabBarItems in my screen. By default all my other tab bar items appear in a small tabBarItem called "More" and you can select the other 4. But I have seen some apps that implement a sliding UITabBarItems with a slide icon instead of a "More" icon.
How can I show just 4 at a moment, and I slide the TabBarItems, and so that I can select the other tab bar items ?
~ Something like this ~
And then I can slide to the next 4 sets by dragging
It would be helpful if someone could point me in the right direction.
There is a nifty little github project that could help you... check it out: https://github.com/iosdeveloper/InfiniTabBar
This is not currently a built-in option for UITabBarContoller.
One way to approach the problem is to add a UIGestureRecognizer to the tabBar.view, and programmatically adjust which 4 options are available on the screen. You can add an animation to make it smooth or have a little bounce as it slides.
iPhone users are usually very picky and attached to Apple's UI Guidelines. Although you can pass the Apple verification, you probably wont be able to pass users' (meaning bad reviews and ratings). So I recommend you to re-consider your tabbar structure and use "..." More instead of sliding it... You can always override stuff in code, but then they wont work smooth with InterfaceBuilder and in the end you will have more trouble than you'd expect.
If you have similar tab items merge them and use maybe a segmented control or something to visually distinguish them. Or use a central navigation screen in which you can put 9 maybe more icons in a grid...
The first solution to your problem may not always be the best way. Well, it is very rare actually...
You have to write a custom control for this.
I wrote one for showing a horizontal menu. You can probably modify that to fit your needs.
http://blog.mugunthkumar.com/coding/ios-control-mkhorizmenu/
In my iPhone app, my navigation bar titles were often too long for the page, causing them to truncate (I usually have a button either side of the title, so space is limited). I therefore created my own title labels with a hard-coded font size so the text would shrink accordingly. However, I now realise that this wont neccesarily look right when other languages are chosen.
What is the normal practice for this? Do people just accept a truncated title, or reduce the font size accordingly (for English), or enforce a very short title that will be short enough in all languages?
I don't think there's a magic solution here. You just need to pick shorter titles or accept the truncation. You can always put the full text in the display rather than in the title bar if necessary.
Based on feedback from some users, I wouldn't go down the route of using smaller text. (I'm basing this on a toolbar at the bottom of the screen rather than the title bar, but the same principle applies.)
I chose one title that is short enough for every language and display it regardless of what the view controller shows.
Apple shows as a title what the view controller shows: in the iPod app, for instance, when you select a playlist, the whole name is displayed. If it is too long, it gets truncated.
So I think it is ok to show a truncated title. You should not however make the text smaller as it will get too hard to read.
Thought it would be relevant to contribute to this discussion with a great solutoin that I came across in one of the apps I've been using.
https://itunes.apple.com/in/app/bookmyshow-movie-event-play/id405894842?mt=8
These guys animate the title left and right within the titleview's bounds, if the title text is too long. Looks neat and elegant without truncation, smaller text or other hassles.
I have a problem with the text shadow of the UIActionSheet buttons. At iOS 4.0.2 long string were truncated automatically. No at iOS 4.2 these texts are presented with a smaller font. But now the offset of the shadow is corrupted and to big.
Is there a possibility to change/remove the text shadow of the UIActionSheet.
EDIT: I'm building the UIActionSheet not with initWithTitle:, but with the normal init and sets all needed properties afterwards because the number of possible buttons is dynamic and the texts cannot be change. I've tested it with initWithTitle: and got the same results.
You can refer this to truncate your string before displaying it in a UIActionSheet.
I can think there are two workarounds for this (although I would not them myself in my application, reason listed below the workarounds):
In the first case you access the sublayers of UIActionSheet, get the labels, change the shadowOffset and shadowColor before presenting the actionsheet.
Secondly you can initialize the actionsheet with blank titles and add your own labels as subviews on the actionsheet at right places. (More tricky then the first approach).
Now the first approach is very risky as the layer structure of UIActionSheet can be changed by apple in future updates, hence your application may break and would not give good results.
Continuing with second approach is good only when you can calculate the exact frames where you should put your lebels so that they look good. But in your case the number of buttons would also vary, so this approach will take a lot of time initially to get the things working.
Hence, I would go for truncating the strings before I set them as the title of buttons.
Not sure how much would this help. But I am sure that truncating strings before setting them as titles is the best option.
are you doing anything non default for displaying the text?
If you only use UIActionSheet-initWithTitle:… you should write a bug report to Apple.
OR shorten the text to "Frankfurt International (FRA), DE" ;)
This appears to be fixed in 4.30. I found no way of fixing it in 4.2x.
I have a UIActionSheet which gives the user a few standard choices. The text on the buttons, however, does not cleverly scale down like a text field though when there's too much-- it just truncates with an ellipsis.
I need to say a little more in on of my action sheet buttons than there's room for. I don't see any way of changing the action sheet's behavior, unfortunately. Any thoughts on alternatives?
Thanks!
You could put some of the descriptive text in the UIActionSheet's title property, and then give just the verb or something concise in the button titles.
One alternative is: you might want to create a full-screen view that you show with presentModalViewController:animated:, where you have more space to show the text.
A third alternative is to create a UIView that animates up with UIButtons that you can customize, but doesn't fill the entire screen. I do that with some of my apps where the Settings are in a tab that slides up but doesn't need to cover the entire screen.