Wednesday, December 25, 2013

With regard to multi-label view

Interface as shown



When I click on the second tab single time, jumped out to a direct interface directly transferred to the main interface of the simulator, and how is it?



. H code that tab: The following

 
# Import


@ Interface SingleComponentPickerViewController: UIViewController

{
IBOutlet UIPickerView * singlepicker;
NSArray * pickerdate;


}
@ Property (nonatomic, retain) UIPickerView * singlepicker;
@ Property (nonatomic, retain) NSArray * pickerdate;

- (IBAction) buttonpressed;

@ End






Tab. M code

 
# Import "SingleComponentPickerViewController.h"


@ Implementation SingleComponentPickerViewController
@ Synthesize singlepicker;
@ Synthesize pickerdate;

/ / The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/ *
- (Id) initWithNibName: (NSString *) nibNameOrNil bundle: (NSBundle *) nibBundleOrNil {
self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil];
if (self) {
/ / Custom initialization.
}
return self;
}
* /

/ *
/ / Implement loadView to create a view hierarchy programmatically, without using a nib.
- (Void) loadView {
}
* /

- (IBAction) buttonpressed
{
NSInteger row = [singlepicker selectedRowInComponent: 0] ;/ / select the frist singlepicker
NSString * select = [pickerdate objectAtIndex: row];
NSString * title = [[NSString alloc] initWithFormat: @ "you select% @", select];
UIAlertView * alert = [[UIAlertView alloc] initWithTitle: title
message: @ "thanks you for choosing"
delegate: nil
cancelButtonTitle: @ "you are welcome"
otherButtonTitles: nil];
[Alert show];
[Alert release];
[Title release];
}

/ / Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (Void) viewDidLoad {
NSArray * array = [[NSArray alloc] initWithObjects: @ "Luke", @ "Leia", @ "Han", @ "Chewbacca", @ "Artoo", @ "Threepio", @ "Lando", nil]; < br />self.pickerdate = array;
[Array release];
[Super viewDidLoad];
}


/ *
/ / Override to allow orientations other than the default portrait orientation.
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation {
/ / Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
* /

- (Void) didReceiveMemoryWarning {
/ / Releases the view if it doesn't have a superview.
[Super didReceiveMemoryWarning];

/ / Release any cached data, images, etc. That aren't in use.
}

- (Void) viewDidUnload {

[Super viewDidUnload];
/ / Release any retained subviews of the main view.
/ / E.g. self.myOutlet = nil;
}


- (Void) dealloc {
[Singlepicker release];
[Pickerdate release];
[Super dealloc];
}

# Pragma mark -
# Pragma mark Picker Data Source Methods
- (NSInteger) numberOfComponentsInPickerView: (UIPickerView *) pickerView
{
return 1;
}

- (NSInteger) pickerView: (UIPickerView *) pickerView numberOfRowInComponent: (NSInteger) component
{
return [pickerdate count];
}
# Pragma mark Picker delegate Methods
- (NSString *) pickerView: (UIPickerView *) pickerView titleForRow: (NSInteger) row forComponent: (NSInteger) component
{
return [pickerdate objectAtIndex: row];
}

@ End




Reply:
You do not know how the link in the IB ~
Reply:
To do so deserted Kazakhstan

No comments:

Post a Comment