小编rav*_*thi的帖子

如何在按钮之间创建空间?

我已经创建了多个按钮,但我不知道如何对齐按钮.

我的代码在这里:

- (void)viewDidLoad 
{
//self.title=@"Asset Management";
[super viewDidLoad];

listOfItems = [[NSMutableArray alloc] init];

[listOfItems addObject:@"User Information"];
[listOfItems addObject:@"Regional Settings"];
[listOfItems addObject:@"Configuration"];

toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 20, 320, 44)];
//UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGs
toolbar.tintColor = [UIColor clearColor];
[toolbar setTranslucent:YES];

// create the array to hold the buttons, which then gets added to the toolbar
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3];

// Create button1
UIBarButtonItem *propertiesButton = [[UIBarButtonItem alloc]
                    initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(button1Pressed)];
[buttons addObject:propertiesButton];
[propertiesButton release];

// Create …
Run Code Online (Sandbox Code Playgroud)

iphone

3
推荐指数
1
解决办法
6448
查看次数

如何以编程方式在iPhone中的UINavigationbar中创建三个按钮?

我正在开发一个小应用程序.我需要在子类中创建三个按钮.一个按钮是add,另一个是search,最后一个是back.我还创建左右按钮.但我无法在导航栏的中心创建搜索按钮.我该如何创建它?我的代码是:

- (void)viewDidLoad 
{
[super viewDidLoad];
UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle:@"Flip"                                            
                                   style:UIBarButtonItemStyleBordered 
                               target:self 
                               action:@selector(flipView)];
self.navigationItem.rightBarButtonItem = flipButton;
[flipButton release];

UIBarButtonItem *flipButtons = [[UIBarButtonItem alloc] 
                               initWithTitle:@"Add"                 
                               style:UIBarButtonItemStyleBordered 
                               target:self 
                               action:@selector(addbuttonview)];
self.navigationItem.leftBarButtonItem = flipButtons;
[flipButtons release];

}
Run Code Online (Sandbox Code Playgroud)

如何在导航栏中创建中间按钮?请帮我.

iphone xcode

1
推荐指数
1
解决办法
6554
查看次数

标签 统计

iphone ×2

xcode ×1