tags:

views:

39

answers:

1
anotherViewController.myLabel = [NSString stringWithFormat:@"Telephone %@", 
      anotherViewController.title];

this is the declaration for a previus label however im not sure how to do this for a button... the data array is located made in this format

  phoneNumbers = [[NSArray alloc] initWithObjects:@"6940313388", @"4045434218", nil ];
self.phoneNumbers =phoneNumbers;

and then the labels are simply added by

 theLabel.text = myLabel;

where mylabel is an NSString

please help ive been trying to solve this for a very long time ...

A: 

this is the code i use to make buttons. then you add the button to a view !

edit: you would change the setTitle: part of this to whatever string you wanted the button to display as its title.

    //create the button
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];

    //sets its size
    [button setFrame:CGRectMake(10, 10, 300, 50)];

    //set title, font size and font color
    [button setTitle:@"Sign Up" forState:UIControlStateNormal];
    [button setFont:[button.font fontWithSize:22]];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:@"green_btn_bg.png"] forState:UIControlStateNormal];
    //set action of the button
    [button addTarget:self action:@selector(signUp:)
     forControlEvents:UIControlEventTouchUpInside];
Jesse Naugher
thanks for your support however im not trying to just make a buttonim asking how its possible to make the button use the selected array shown above (part 2 of the code) to show something that is similar to part(1) that can be read and interperted for multiple views. so basically im asking to change the label format into a a button one...
Alex