I am working on an application which allows users to work with a couple of workmodes. Main view of the app contains information common to all workmodes. I want to create a "subview" with ability to change its ViewController. This subview will be used to display information connected with specified workmode. It is important that app goes to MainViewController from WorkmodesViewController in which user chooses workmode to work with.
My question is:
Which tehnique should I use to acheave changeable WorkmodeViewController inside MainViewVontroller
I have found example git project with functionality I need:
https://github.com/mluton/EmbeddedSwapping
Related
I'm working on a sharing extension in iOS with Swift. In the share app, I would like to add a custom field, where the user can add text to it. I tried finding references to see how it could be done but I can't find any.
Can someone help me out please?
You can't magically make a text field appear in the SLComposeServiceViewController interface. So you have two choices:
Use SLComposeServiceViewController, and add a configuration item (SLComposeSheetConfigurationItem) which you've set up so that it pushes some new interface containing a text field.
The pushed interface is up to you, even though the SLComposeServiceViewController interface is not.
Don't use SLComposeServiceViewController in the first place. Now the whole interface is up to you. Just use a normal view controller and it will be presented for you, and you can design the view in the storyboard just like always.
I have my WatchKit app (WatchOS1) set up in the following way (names have been changed to be project unspecific):
InitialInterfaceController - The main entry point of the watch app. This controller is only used to load several instances (using the same identifier repeatedly in the NSArray) of the next view using reloadRootControllersWithNames:contexts: (called from awakeWithContext:).
FirstInterfaceController - This Interface controller should be what is first displayed for the pages.
However this does not work - I get left with the blank InitialInterfaceController screen. If however I call [self presentControllerWithNames:contexts:] it works as expected, but includes the cancel button, which is not what I want.
I have seen people suggesting to use this method to dynamically create multiple page navigation scenes, but I cannot see why this doesn't work. The FirstInterfaceController's awakeWithContext: is never called.
Has anybody had this problem or is there a fix available?
Do you have the right value for the Identity in the interface controller's attribute inspector? (I have seen issues when the identity and class name are the same, make sure they are different)
Is that interface controller added to the right module in the identity inspector?
I've searched through the forums and wasn't able to find anything similar to this question. It's my first time posting so please let me know if I need to add anymore information and I'll try my best!
I'm exploring Xcode and building an app for iOS 7 on an iPhone. I'm using a hypothetical purpose for the app just to see if I can learn how to build the thing (it's a booking system for taxis). It's a tabbed application (I have three tabs at the bottom corresponding to three different screens of the app, one is rates which displays a scrollable image of rates, one is a booking system that sends an email with information taken from text fields, and one is a settings page)
My questions is as follows:
On the booking page, I'd like to have a switch that either enables or disables user entry into additional text fields (it's actually for the option to book a 'return' journey, so the user can add in extra information for the return booking).
I have my page set up with the first text fields in place, but I can't for the life of me figure out or find anywhere about how to make this switch enable entry into the additional text fields. Ideally I'd like them to be greyed out and disabled if the switch is off, and enabled if the switch is on.
Any help on the matter would be much appreciated!
Thanks.
edit:I'm also doing this with storyboard, wasn't sure if this made a difference!
You can use UISwitch and UITextField for this. UITextField has a property called enabled that controls whether the user can interact with it.
First you need to create an IBOutlet for your UITextField in storyboard by control-dragging it to respective #interface definition in your header file. Then you need to create an IBAction for your UISwitch, again by control-dragging it to #interface (choosing 'Action' for 'Connection' and 'changed' for 'Event').
Finally implement the newly generated method like this:
#implementation ViewController
-(void)mySwitchChanged:(id)sender
{
UISwitch *mySwitch=(UISwitch *)sender;
myTextField.enabled=[mySwitch isOn];
}
.
.
I am wondering what RestorationIdentifier is, and why would we use it? I saw RestorationIdentifier on MMDrawerController.
MMDrawerController using like this : `
[self setRestorationIdentifier:#"MMExampleCenterControllerRestorationKey"];`
Consider that you want to allow your user to close the app and then return to exactly where they were when they open the app again. And you should want to do that. Broadly you have 2 options:
Implement it yourself, saving everything into user defaults or similar and reconstructing the view hierarchy yourself
Use Apple State Preservation which will automatically rebuild the view hierarchy for you and which you can tie into to save and restore other pertinent information
Option 2 is behind the use of the restoration id (so that the view hierarchy can be recorded and rebuilt).
It is a property of UIViewController which indicates whether the ViewController and its contents should be preserved and is also used to identify the ViewController during the restoration/relaunch process.
Ref : https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/index.html#//apple_ref/occ/instp/UIViewController/restorationIdentifier
I'd like to add some custom buttons to an ABUnknownPersonView. Can I use initWithNibName:bundle: in my ABUnknownPersonViewController to load a custom view that I've created in IB, while not using an "undocumented api?" And if I do, how can I make sure that it follows all the properties and responds to all the hooks that the controller expects?
I typically create all my views programmatically and I generally like the view that ABUnknownPersonViewController creates. I'd rather just start from there. And so I accessed the view and dropped in a button, but with later versions of iOS that broke since that isn't a hook that Apple created.
initWithNibName is also not mentioned in the ABUnknownPersonViewController documentation but it is a method of it's parent class UIViewController. Does that make it safe to use?
You cannot provide a replacement XIB. While I understand you want to avoid it, you will have to use the underlying AddressBook framework and building your own version out of it.
You can, of course, look at open source stuff such as this for a good starting point.