Is it Possible to add a custom Navigation Bar for CNContactViewController? - ios

I want to create a custom UINavigationBar for CNContactViewController in order to select single or multiple contact. The default UINavigationBar consists of Cancel,Done and Group button which makes it look quite messy. Is there a workaround to customize the UINavigationBar of the CNContactViewController?
Can Anyone answer this asap?

Your screenshot is CNContactPickerViewController, not CNContactViewController. But the answer is the same for both.
The Contacts view controllers each have a very specific purpose: choosing a contact, creating a contact, etc. They each have a navigation bar suited to that purpose — the contact pocket needs that Done button so the user can select a contact and return control to your app. And they're hosted out of process so that malicious apps can't dig inside to harvest contact info they're not supposed to.
Since it's out of process, you can't customize the navigation bar directly. Contacts would need to define an API for that, and it doesn't. Perhaps you should file a feature request for that? Then again, I'm not sure what the use case for removing any of those buttons is...

Related

How to create compose bar button item like in Messages app

The Messages app on iOS places two bar button items next to the large title text "Messages" in the master view controller with a circled style.
How do you make your own bar button items in the navigation bar have this same behavior?
I think this demo project should give you enough hints to help you.
Addendum: You may be already aware of this, but in case you specifically wanted a search bar as well, there is also a UISearchController ViewController to help with getting user input and populating a TableView with results.
Addendum: Looking into it further, there’s already an SO answer covering this. Additionally, consulting the API reference show that setToolbarItems already supports adding an array of UIBarButtonItem
As far as custom buttons are concerned, check out this reference, there’s a section on customizing appearance. Additionally, the constructor for UIBarButtonItem conveniently supports taking a UIImage as well. If what’s there is insufficient to accomplish what you need, you can always subclass UIBarButtonItem and change the views there.

How to write to a sidebar menu from another view

I have an app where there is a sidebar menu. Like the Instagram and Facebook apps, I have a user settings view, where I can upload a picture. This picture is also shown in the sidebar menu. This picture is loaded once, when the sidebar menu tickers viewdidload.
The problem is if the user changes the image in the user settings view, I can't get it to update the sidebar menu. The viewdidload runs only once.
The best thing would be if i could set the UIimage in the sidebar from the user settings view - but is this even possible?
I not that good at Xcode (swift) yet so bear with me.
Without code samples or knowing the implementation of your sidebar these are just guesses. viewDidLoad is only called once when the view is added to the hierarchy. Try moving logic that needs to execute on each subsequent appearance to viewWillAppear.
In the past when I've implemented a sidebar, I've used a UITableView or UICollectionView. This simplified determining what was selected and reloading the state/data of the view as you're using well defined delegates and methods. This worked well for me but YMMV.
The best thing would be if i could set the UIimage in the sidebar from the user settings view - but is this even possible?
It is probably best to keep your sidebar and settings view separate. They don't need to know that the other exists. This doesn't mean they shouldn't share the same data or an abstraction (service class, plist, etc) over that data.
You have several possibilites to get this done. A non exhausting list:
NSNotificationCenter
Key Value Observing
Delegation
Make your menuVC a delegate for the viewController where your profile-image-change action can be performed. When someone changes the profile-image, call:
delegate.profileImageDidChange()
In your delegate protocol, you have to define that method of course. Please see the tutorial on Delegation (Hyperlink). If you need more help with implementing it into your code, just ask another question or edit your question.

iOS: Adding UISearchbar with filter Options in a tableview

I am relatively new to iOS (coming from android background), and I would like to know how to implement and have a searchbar like in these two pictures http://i.stack.imgur.com/rQKE5.jpg and here(linkedin) http://i.stack.imgur.com/BnIG2.png . Would like to know how to make make the filters/options appear dynamicly when users clicks on search field and affect the results shown in the uitable. Example on linkedin 4 filters appear when user clicks on search. I have search on the net but I didn't manage to find persistent results. Again, what I want to know is how to show those options/filters when user click on searchbar
Any help is apreaciated, code or sample/ existing projects would be very useful.
Thank you all in advanced
UIKit comes with a dedicated built-in solution for searching in conjunction with a UITableViewController, called UISearchDisplayController. It provides everything (albeit without much customization), including the search bar view, an optional scope bar for filtering, and transitions.
Reference:
https://developer.apple.com/library/ios/documentation/uikit/reference/UISearchDisplayController_Class/Reference/Reference.html
Edit:
Here is a tutorial: http://www.appcoda.com/search-bar-tutorial-ios7/
And here is another one that includes a scope bar: http://www.raywenderlich.com/16873/how-to-add-search-into-a-table-view
Edit: All of this is obsolete now
iOS8 introduces a new class UISearchController to make this much cleaner.
See http://useyourloaf.com/blog/2015/02/16/updating-to-the-ios-8-search-controller.html

UIPickerView alternative for iphone something like combo box?

Are there any alternative controls instead of UIPickerView in XCode. If yes, how do they work? Can anyone suggest an alternative for UIPickerView?
You can see one in action if you download the free One Stop Plus app (women's clothes), drill down on the products until you get a view with Color, Size, etc. Tapping those buttons animates a table out of the button, with choices. Selecting one causes the table to animate back into the button. If you like that post a comment to this answer and I can tell you how to do it.
With iPhone interface, it is not feasible to enable a Combo box like a website. (I believe even Apple Guidelines would say not to do it). What you need to do is the use the UITableView to enable users to pick one option.
One thing you can do is decide whether you want to have the choice in a view shared with other controls. OR if your list if too long you can chose to push in a new view with only the choices on them and when a user selects one, the view will pop back one level.
Here is a screen shot of what i mean (maybe not the best example out there):

How to implement tabs on an individual interface in iOS, not app-wide?

I'd like to implement tabs on an individual iOS interface. The data source for this interface is a list of invoices. I need to display three different sub-lists from the data set: open invoices, un-synced delivered invoices, and synced delivered invoices. I'd like each of these sub-lists to be accessible via the same UINavigation controller and have which view is displayed be controlled by a top-of-the-screen tab interface.
I read in Apple's guidelines that the in-built tab bar controller is only intended to be used either app-wide or modally as a popover in iPad. (I'm only working with iPhone and iPod as my target devices.) Reference: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/TabBarControllers/TabBarControllers.html
I also read in Apple's guidelines that the TitleView of UINavigationController can be overridden to display a segmented control group of buttons. I'm thinking that this will be a good way to accomplish my design goals. Reference: http://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Art/navbar_custom_items.jpg
Are there any other good ways to accomplish my goals?
You could use a UITabBarController on that one view, but it would probably confuse users since it's not a common technique.
Another way is to have a parent UITableView with the three different categories, and tapping on one of the three cells would take you to the corresponding subset of data.
I recommend using a segmented control in the navigation bar similar to the top charts page in the App Store app. It does what you want, and is consistent with Apple's Human Interface Guidelines.

Resources