Anybody can give more detail about the answer to the question "How do I make a modal date picker that only covers half the screen?" which is answered by user eladleb.
#interface pickerCell : UITableViewCell
{
UITextField *txtTextField;
UIPickerView* dtpPicker;
}
especially step 2, 3, 4, anybody can elaborate in detail(i.e. which method...)? sample codes are highly appreciated. Thanks.
iOS has a UIActionSheet that is designed for uses just like that.
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIActionSheet_Class/Reference/Reference.html
There is also an open source framework that will take a lot of the work out of putting the picker in an actionsheet. This way, when a user taps a cell, show the action sheet.
https://github.com/TimCinel/ActionSheetPicker
Related
I have a screen that has a UITextField and a button. i got the code down to check if the password is correct, the only thing i need is some help to navigate screens. every tutorial i see uses XIB screens and i am using storyboard. Some help would be greatly appreciated. this is the code to check the textField:
-(IBAction)checkField:(id)sender{
NSString *pass = #"apc";
if([pass isEqualToString:password.text]){
//Enter code to let storyboard know if its right or not?
}else{
//Make a pop-up dialog(least of my worries right now!)
}
}
any help would be greatly appreciated. if you need to see more of my code to help just please ask !!!!!
Preparation
Create a custom segue in your storyboard, which tells the code where to go. You can simply drag a segue by holding ctrl. Drag it from one view to another view, but don't drag it from a button or something. Use the views themselves.
Give the segue a name (identifier) by clicking it and giving it a name.
Execution
Simply call [self performSegueWithIdentifier:#"identifier" sender:self];
And that's it :-)
I would like to make a simple app with a UITableView and a Details View. I've already done that before. The only difference now is that I would like it to be an universal app that is organized like this :
For iPhone : a UINavigationController with 2 levels. My TableView Controller and then a UIViewController to show the details
For iPad : an UISplitViewController for both the TableView and Details view controller.
I don't know where to start. Could someone point me on a good tutorial for this?
Thanks in advance.
I finally found a code example at this location : https://github.com/kwylez/Universal-iOS-App-Template
I wan't to creata a "CatchNames" class which I can import into a view Controller that shows a text which asks for text input. I would like to be able to add an instance of CatchNames to my view, have it ask the user for three names in a row and return them in an array.
[self.view addSubview:[catchNames view]];
NSArray *myNamesArray = [catchNames namesArray];
The best way would be to have the application freeze kind of the way it does when you are prompted to enter a password in iOS and continue when the user entered 3 names so I can immediately catch the array in the next line.
While this might not be the best description I still hope you understand my problem.
How can I approach this?
Thank you in advance
I guess you appear to be looking to implement a simple form which gets the user input, retrieves and stores it in an array? Hopefully I haven't misunderstood the question, but this seems to be a simple task you can accomplish with one or more UITextField's and a UIButton as a 'Add' or 'Done' call to action.
Are you looking for some general UI coding level help regarding implementing such a view? If so, I would encourage taking a look at the XCode documentations of UITextField (for capturing text), UIButton (for handling actions) and UIView (for view hierarchy and animation implementation).
Some quick notes;
Looks like 3 names are compulsory, so, you may verify whether a UITextField is empty at the button's click action.
Have the array declared in the view controller, not the view
The 'freezing' you require should take care of itself as long as the view offers no other way out for the user other than clicking the button.
Do excuse me if I am oversimplifying the problem. Let me know if you need me to drill down into anything further.
Cheers!
I am new to programming for the iPhone and this will be my first question here. I have experience with different languages like php/java/c++.
My question is about ViewControllers and views in iOS.
I have started a project which will contain several different things like a login screen, a main screen and several other screens. The goal of this project is to learn how to create everything programmatically instead of using interface builder to get more accustomed to the system. I am using the book: "Advanced iOS 4 Programming" to help me.
I have been able to create all the screens ( and stuff like logging-in is working ), but I am not sure if I did it correctly.
All of my code for creating the textfields/labels/buttons is now located in the ViewController while the main view where everything is put on is almost empty, with nothing being done in it. Shouldn't the code to create the textfields and other components be located in the view itself, or is this the correct approach?
I have looked at several different examples but most use interface builder. The book itself is also not very clear in this matter.
Thanks in advance.
Kind regards,
Jasper
In the view you have the view - on other words, literally what the human user sees with their eyeballs.
So, for example, if you are doing complicated drawing you will have your own custom drawRect: method, and that for example is in the view.
On the other hands ......
In the view controller you have things that control the view.
Generally speaking "everything" goes in the view controller.
When you first start programming for iPhone (or Mac), simply put everything in the view controller and don't worry too much. There's plenty to learn. OK?
Eventually, separate out the "actual drawing" separately in to the view.
Hope this simple explanation for beginners helps!
In simple controller code should contain methods like...
class myLoginController : NSObject
{
UIView *myView;
}
-(void) initLoginController
-(void) loadLoginViewInView :(UIView*)inView;
-(void) removeLoginView;
-(void) isViewLoaded;
-(void) submitButtonClicked : (id) button;
-(BOOL) isLoginSuccess;
and initLoginController you can create your view,
-(void) loadLoginViewInView :(UIView*)inView
{
[inView addSubview:myView];
}
and in removeLoginView you can remove "myView" from its superView .
How would I go about updating an object declared in the RootViewController from my MainViewController?
I'm attempting to hide my info button when my iAd is tapped, I have all the relevant pieces of code for the iAd in place, but can't figure out how to code the action. I saw an example of a similar situation online that was like this:
((MainViewController *)parentViewController).infoButton.hidden = #"";
I haven't been able to get that to work though, I just need this one value modifiable from the MVC, can anyone give me a simple suggestion?
P.S. I'm a total n00b and a snippet of code would help a great deal, I'm kind of learning as I go, thanks!
I figured this out through use of the NSNotificationCenter