1

I have added the button in storyboard like the following picture:

enter image description here

I also have added the code in the header file as shown in the following code:

#import <UIKit/UIKit.h>

    @interface ViewController : UIViewController <UIPickerViewDataSource,UIPickerViewDelegate>

    @property (strong, nonatomic) IBOutlet UIButton *Up;
    @property (strong, nonatomic) IBOutlet UIButton *Back;
    @property (strong, nonatomic) IBOutlet UIButton *Left;
    @property (strong, nonatomic) IBOutlet UIButton *Ok;
    @property (strong, nonatomic) IBOutlet UIButton *Right;
    @property (strong, nonatomic) IBOutlet UIPickerView *DeviceSelect;

    @end

I want to add the style for the UIButton in the .m file as shown in the following code:

self.Up = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[self.view addSubview:_Up];

But it seems its not working. The UIButton didn't change anything.

Did I miss something?

I am new to iOS , Please teach me... Thanks in advance.

ShastriH
  • 210
  • 1
  • 3
  • 12
Wun
  • 6,211
  • 11
  • 56
  • 101
  • 1
    As of the more minimalistic UI delivered in iOS 7, [iOS doesn't really have "round rect" buttons anymore](http://stackoverflow.com/questions/18384832/no-round-rect-button-in-xcode-5). They are simply text labels that the user presses. – Michael Dautermann Sep 29 '14 at 03:35
  • But the button didn't change anything whatever I use any style... – Wun Sep 29 '14 at 03:39

1 Answers1

1

You've already added your button in the storyboard file and because you added buttons that way, you should not do these two lines of code:

self.Up = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[self.view addSubview:_Up];

You can set the button style via the attributes inspector in Xcode's Interface Builder (which you see when editing the storyboard).

It looks like this:

Use Attributes Inspector to set the button type

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215