1
我想稍微定制一个UIActionSheet
;只需在现有的2个按钮之上添加一个自定义的UIButton/UIImageView,就像之前的文章一样,但是使用自定义按钮/图像而不是默认按钮上方的文本。我尝试添加一个简单的UILabel
以查看它是否正常工作:UIActionSheet Customization。如何使用默认按钮将自定义控件添加到ActionSheet?
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle: @""
delegate: self
cancelButtonTitle: NSLocalizedString(@"Cancel",@"cancel button")
destructiveButtonTitle: nil
otherButtonTitles: @"Send",nil];
actionSheet.tag = kCallActionSheetTag;
UILabel *btn = [[UILabel alloc] initWithFrame:
CGRectMake(18, 10, 140, 50)];
accountLabel.textAlignment = UITextAlignmentLeft;
accountLabel.textColor = [UIColor whiteColor];
accountLabel.text = @"Account";
accountLabel.font = [UIFont boldSystemFontOfSize:16];
accountLabel.backgroundColor = [UIColor clearColor];
[actionSheet addSubview:accountLabel];
[accountLabel release];
[actionSheet showInView:self.tabBarController.view];
[actionSheet setBounds:CGRectMake(0,0,320, 260)];
[actionSheet release];
如果我使用上面的代码中,两个按钮被垂直向上移动和UILabel
重叠顶部按钮。他们似乎被锁定在操作单的顶部。我宁愿不添加我自己的按钮并定位它们。做这个的最好方式是什么?
感谢