I am working on iOS Address Book but having some issues, I am referring the iOS programming guide which says
Prompting the User to Choose a Person Record:
The ABPeoplePickerNavigationController class allows users to browse their
list of contacts and select a person and, at your option, one of that
person’s properties. To use a people picker, do the following:
Create and initialize an instance of the class.
Set the delegate, which must adopt the ABPeoplePickerNavigationControllerDelegate protocol.
Optionally, set displayedProperties to the array of properties you want displayed. The relevant constants are defined as integers; wrap
them in an NSNumber object using the numberWithInt: method to get an
object that can be put in an array.
Present the people picker as a modal view controller using the presentModalViewController:animated: method. It is recommended that
you present it using animation.
Point one says Create and initialize an instance of the class, its init methods includes withnibname other property is inputview, can this be used to customize address book gui?
point three is also pointing towards displayedProperties, address book gui can be modified?
Like whatsapp, viber, etc .. I also want to customize the address book
so I can also display status under contacts name, so I can display
custom image as accessories etc etc. Please check the screenshots.
I believe they are not using the build in ABPeoplePickerNavigationController Class.
They fethc all the users from the address book and populate it into a table view.
I don't know of any way to customize the ABPeoplePickerNavigationController Class.
Related
I'm presenting a page based modal using [self presentControllerWithNames:self.controllerNames contexts:self.controllerContexts];, where controllerNames is just an NSArray of NSStrings containing my interface controllers names. The problem is that I would like to access the created controllers.
The documentations says that
WatchKit loads and initializes the new interface controllers and animates them into position on top of the current interface controller.
but I would like to have a reference to them, in order to call the becomeCurrentPage method from outside.
So, I would like to be able to save those controllers after they are created in a list, and programmatically change the page using something like [self.controllers[2] becomeCurrentPage].
Because you're allowed to provide a context when you present an interface controller, you can pass a reference to self. That way, you can establish a reference from the presented controller to its parent. Once that relationship exists, you can use things like delegation patterns to communicate.
I use this extensively in my own Watch app, and I've wrapped a lot of these mechanics in my JBInterfaceController subclass on GitHub.
In Xcode, I'm making a Mac application in Objective-C. In designing my application's window, I realized there was an object called the User Defaults Controller in the Object Browser. What is this for? I know what the user defaults are, but what is the purpose of this in the object browser? What would be an example of when one would use this? Thanks!
The Controller's purpose is to bind your User Interface elements to the User Defaults.
As an example, you can have an NSTextField in your interface representing a configuration preference (for example default document title). You bind this to the User Defaults Controller. With this method the user can specify a default title that is being saved or updated automatically by the Cocoa Framework without writing a single line of code.
To to this, in IB put a controller and a textfield. In the bindings inspector, set the textfiled's String property to bind to the User Defaults Controller, set the Controller Key to values and set the Model Key Path to the key used in User Defaults.
It's used by Cocoa Bindings, to allow binding of UI elements to the NSUserDefaults.
I'm going through my code to make sure that all of my properties have the proper weak/strong modifier and I ran across this situation which I don't know what to do with. Keep in mind that I'm fairly new to iOS programming.
I have a normal MVC hierarchy where my controller creates an object called FieldManager. This FieldManager is used by my controller to dynamically create textfields. However, this FieldManager also needs to be used by the controller's model to periodically query the manager to find out information about the fields (such as is it required, should it's text be capitalized...etc).
So to summarize, I have a controller which creates an object that is used both by the controller and the controller's model. Therefore, I don't know if I should make the model's reference to FieldManager a weak property or the controller's reference to it a weak property. It seems that I should make both weak properties, otherwise FieldManager will get released. What should I do?
Thanks.
Things like that should belong to your model, so the way to go is to have a datasource.
Your controller asks the datasource to create and return the textfields, the datasource contacts the model and asks for a field manager for that model.
That's the way I would do it...
I'm working on an app that (among other things) uses UIImagePicker to grab an image from the device once the user has selected the SourceType by tapping the appropriate button. Different sections of the app will need to use this functionality, as well as the variable holding the image information once selected. When I first started the project I had all of my code to do this in a single class named ViewController. I'm now working on moving the individual sections of the app into their own classes, but I'd like to be able to have them all use the UIImagePicker functionality from a central location.
Along with the necessary UIImagePickerController methods and protocols, I have a method that presents a view with buttons for each available SourceType. Each of these buttons then send a message to methods to show the appropriate picker (or the camera). Once an image is selected, it is applied to a variable for use by the different sections.
I wanted to get suggestions on the best way to approach this before I went to deep down the wrong rabbit hole.
Thanks!
If a lot of your classes use this functionality, you can create a superclass (itself being a subclass of UIViewController).
This class will expose some method to launch the process you described, and some other to gather the information collected.
If you don't want to use inheritance, or you already to with another class, you can also create a separate class responsible for this process.
This class, which is not necessary a UIViewController, has to be instantiated and then called the same way the superclass described above.
I'm curious if it's possible to create an application according to window-based pattern, add UILabel, create a new class, and to be able to change UILabel's value from this new class.
After creating all that files we will have:
NewApplicationDelegate.h, .m;
Newclass.h, .m;
MainWindow.xib.
The IBOutlet in this case must be added to MainWindow.xib, and I want to change its value from NewCalss.m. Is it possible? How can I do that?
The point is that I was working only with navigation-based or simple window-based applications before, and now I need to have one view available and changeable (UILabels, for example) from at least 2 other classes.
Thanks.
You will have a UIController object too - right?
That has a handle on the UI elements, UILabel etc, whichever you map through.
You could pass this to the Newclass or you could provide an interface/protocol that the controller exposes that allows Newclass to interact with what you want to do.