UITabBarItem default with custom title - ios

I am trying this for a while now, I do have a UiTabBar with three elements in my swift iOS app and I would like to use default images every TabBarItem, but combined with a custom title. It is not possible to do this in the StoryBoard, so I try to do this for every element in the ViewControllerClass of every page. Just one example:
self.tabBarItem = UITabBarItem.init(tabBarSystemItem: UITabBarSystemItem.bookmarks, tag: 0)
self.tabBarItem.title = "Test"
Does anybody of you know a trick how to combine both of it? It seems like it's not possible to combine default images and custom titles...

From Apple docs (https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem):
The title and image of system tab bar items cannot be changed.
Presumably, this is because Apple likes apps to be consistent. They don't want users to be confused by seeing a common system Icon that doesn't do what it's expected to do.

Related

Calabash iOS how to tap the back button item

Guys just cant figure out how to tap on BackButtonItem from Navigation Bar with Calabash framework, I'm setting accessibilityLabel like this:
self.navigationItem.leftBarButtonItem?.accessibilityLabel = "goBack"
and trying to test it like this with no luck:
touch("* marked:'goBack'")
touch_transition('navigationItemButtonView first',
"* marked:'#{goBack}'")
The problem is that UINavigationItem, UITabBarItem, and UIToobarItem are converted, at runtime, to Views. For example, a UITabBarItem is converted to a UIToobarButton. In the conversion, the accessibilityIdentifier and accessibilityLabel are not preserved.
# This will probably get you the left navbar button
query("UINavigationItemButtonView index:0")
There are ways to enforce that an accessibilityIdentifier is preserved, such as making the navigation item from a custom view.
Take a look at the briar bars/navbar.rb for inspiration. I do not recommend using briar in your project; its life is uncertain (I am the maintainer).
I'd recommend trying query "all * marked:'goBack'" and if that still doesn't return any results, just try a query "all *" and see if the label shows up in the results.
You could also try setting the accessibilityIdentifier of the view - generally that's the preferred way to set up views for automation.
Just updating it might be helpful for someone who wish to use default back button
touch('navigationItemButtonView first')
This will take you back.
Found from calabash predefined steps.

iOS) How to add a divider(==separator) between tabbarItems

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.

How to get square hovering over button iOS

Sorry, the question isn't really clear, but basically I want a button or a label or something like that that says "notifications" and a small red square (like Facebook) that displays the number of notifications that user has (if they have any). How would I go about doing that? I'm not too advanced with UI design in iOS yet. I'm coming from an Android background so feel free to use any comparisons if there are any.
What you are referring to is called a badge. Some native controls have them (tab bar buttons come to mind), but most do not.
If you are using a tab bar controller, you can set the badge value from the UIViewController. Something like this:
[[self tabBarItem] setBadgeValue:#"1"];
If you are looking to implement a custom one, it could be easily accomplished with a UIView and a UILabel. Add a badge view to what ever view based control you are creating, then add a label to that badge view and set its text. There are probably lots of third party ones floating around the web already though.

Create a new status bar

I'm creating prototype apps and need to have a custom carrier instead of showing AT&T/Verizon or whatever actual carrier is on the phone.
I have a fake home screen which the app launches from, but want to have the custom status bar appear for it and the screens after. These are all black statusbars.
Any suggestions for the best way to do this? I created a UIViewController subclass that simply adds an image of the status bar with a label set to the current time, but this won't work if I use a nav bar.
Ideally this is done in a way where I can use the real status bar, but I can put a uiview over the carrier area with the text I'd like. This way I don't have to code in a time and battery icon.
Note that since these are prototypes, I don't need to worry about app store approval.
hide the real status bar and make one with UIView or make a image that looks like it in a UIImageView
After trying a few different ways, I stumbled upon this code that works: https://gist.github.com/guidosabatini/4066796
Haven't been able to test on a live device.
This is what I was using previously (with some modifications): http://www.cocoaintheshell.com/2010/11/custom-status-bar-ios/

Unusually cool looking tab bar setup within a rootviewcontroller of a UISplitView

The ABC (Australian Broadcasting Corporation) iView app for iPad, has great looking tab like setup within a rootViewController of a UISplitView.
The tabs named "Browse/Watch/Listen" are particularly interesting are they simulated or real tabs?
It's unlike any UITabBar I've seen around in iPad apps.
Does anyone know how something like that is possible?
The round rect button in custom mode will be transparent and any png image will maintain in transparencies.
3 or more buttons with transparent images would be the way to go. A different color for when they are selected and your all set. You could also make them look like they are overlapping with images that continue the button next to it.
With the iOS devices it is more about appearance and less about the underlying functionality.
This is a custom control, they made themselves from scratch.
Fortunately for you, you don't need to make it from scratch. :)
There's a lot of open source component that does just this, just like these ones.
Those tabs look and feel like 3 UIButtons. Notice how the UI highlight acts when touching the buttons, and the action is only triggered on touchUpInside.
The tab content is probably a UITableView which gets refreshed when switching tabs.

Resources