iOS, how to make a custom uibarbuttonitem with no-border, no-span with each other?
like this picture?
I do not know how to name this style. all these buttons are on the UIToolBar component.
thank you very much.
iOS, how to make a custom uibarbuttonitem with no-border, no-span with each other?
like this picture?
I do not know how to name this style. all these buttons are on the UIToolBar component.
thank you very much.
私の理解では、そのような場合はセグメントコントローラーを使用することをお勧めしますが、使用したくない場合は、次の方法でバーボタンに画像を適用できます。
UIImage *image=[[UIImage imageNamed:@"barbuttonimage.png"] stretchableImageWithLeftCapWidth:50 topCapHeight:10];
// Specify width & height as per your need..
CGRect frameimg = CGRectMake(0, 0, image.size.width,image.size.height);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
[someButton setBackgroundImage:image forState:UIControlStateNormal];
[someButton addTarget:self action:@selector(myBarbuttonEvent)
forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *myBarbutton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.leftBarButtonItem=mailbutton;
[someButton release];
これがお役に立てば幸いです。ありがとう。