小编use*_*133的帖子

在UIBarButtonSystemItemPlay和UIBarButtonSystemItemPause之间切换

有两个UIBarButtonItem想要将它作为一个UIBarButtonItem并在它们之间切换

UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc]
                               initWithBarButtonSystemItem:UIBarButtonSystemItemPlay 
                               target:self 
                               action:@selector(playaudio:)];

systemItem1.style = UIBarButtonItemStyleBordered;

UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] 
                               initWithBarButtonSystemItem:UIBarButtonSystemItemPause
                               target:self
                               action:@selector(pause:)];

systemItem2.style = UIBarButtonItemStyleBordered;


// flex item used to put space in between buttons

UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] 
                             initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
                             target:nil
                             action:nil];

//Add buttons to the array

NSArray *toolbarItems = [NSArray arrayWithObjects: settingsButton, flexItem, systemItem, flexItem, systemItem1,flexItem, systemItem2, flexItem, systemItem3, flexItem, modalBarButtonItem, nil];

 [toolbar setItems:toolbarItems];

[settingsButton release];
[systemItem  release];
[systemItem1 release];
[systemItem2 release];
[systemItem3 release];
[modalBarButtonItem release];
[flexItem release];

-(void) playaudio: …
Run Code Online (Sandbox Code Playgroud)

iphone

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

UIButtonTypeRoundedRect的框架

对于UIButton,我现在使用第一个UIButtonTypeCustom我想将其更改为RoundedRect但是当我将UIButtonTypeCustom更改为UIButtonTypeRoundedRect时,它显示白色的RoundedRect而不是为其指定的颜色,并且它还显示了圆形按钮后面的rect按钮框的边缘.所以我想知道如何解决这个问题.

UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

[myButton addTarget:self action:@selector(dismissView:) forControlEvents:UIControlEventTouchUpInside];

myButton.frame = CGRectMake(0, 0, 60, 30);

[myButton setTitle:@"Done" forState:UIControlStateNormal];

myButton.backgroundColor = [UIColor colorWithHue:1.0/12 saturation:2.0/3 brightness:4.0/10 alpha:1.0];

UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:myButton];

[[self navigationItem] setLeftBarButtonItem:button animated:YES];
Run Code Online (Sandbox Code Playgroud)

感谢帮助.

iphone

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

我们如何在UIButton上添加UIPopOverController?

我有一个问题,因为上半个小时.UIButton 我正在使用,我想UIPopovercontroller在它上面显示.但它崩溃了touchUpinside action.我知道如果我使用我们可以轻松完成UIBarButton但我有一些UI specification这就是为什么我不能使用UIBarButtonUIToolbar.

所以,如果有人有任何想法UIPopovercontroller,UIButton那么请帮助我.帮助将是appriciated.

iphone uibutton uipopovercontroller

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

隐藏 UIMenuController

想要隐藏显示剪切、复制、粘贴、选择、选择所有菜单的UIMenuController

任何人都知道怎么做

iphone

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

iPhone应用程序只有纵向模式

如何才能使我的应用始终处于纵向模式.如果我旋转iPhone,它不应该以横向模式显示应用程序.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortrait);

return YES;
}
Run Code Online (Sandbox Code Playgroud)

在此编码后我旋转iPhone应用程序以横向模式显示.如何让应用程序始终处于纵向模式.

iphone objective-c

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

如何使UIBarButtonSystemItem接壤?

我在UIToolbar上玩UIBarButtonItem.我想让风格与众不同.因为它是系统项目,有没有办法使它成为边界风格?

UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self  action:@selector(play:)];
Run Code Online (Sandbox Code Playgroud)

objective-c ios

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

使用ARC时声明委托

在fastpdfkit中有这样的委托声明

@interface BookmarkViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {

//Delegate to get the current page and tell to show a certain page. It can also be used to
//  get a list of bookmarks for the current document. 

NSObject<BookmarkViewControllerDelegate> *delegate; 
 }

@property (nonatomic, assign) NSObject<BookmarkViewControllerDelegate> *delegate;

@synthesize delegate;
Run Code Online (Sandbox Code Playgroud)

因为我使用ARC所以委托的声明是这样的

@interface BookmarkViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {

 id __unsafe_unretained <BookmarkViewControllerDelegate> delegate;
 }

@property (unsafe_unretained) id <BookmarkViewControllerDelegate> delegate;

 @synthesize delegate;
Run Code Online (Sandbox Code Playgroud)

这是正确的原因当即时调试我得到

 currentPage    NSUInteger  0
delegate    objc_object *   0x00000000
Run Code Online (Sandbox Code Playgroud)

iphone delegates automatic-ref-counting ios6

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