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
重疊頂部按鈕。他們似乎被鎖定在操作單的頂部。我寧願不添加我自己的按鈕並定位它們。做這個的最好方式是什麼?
感謝