我想爲我的操作表的按鈕中的文本設置更小的字體,因爲我的文本比寬度更長。iPhone,如何在動作表按鈕中縮小字體大小?
如何縮小字體大小?
我在猜測,你可以添加選擇器視圖到動作表,我可能需要將我自己的按鈕添加到動作表,如果是這樣?
我需要一個例子。
編輯:我已經取得了一些進展,但實際的按鈕沒有顯示,但你可以看到它在點擊按鈕文本時發生改變。
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"OK",nil];
CGRect frame = CGRectMake(100.0, 80.0, 100.0, 40.0);
UIButton *pickerView = [[UIButton alloc] initWithFrame:frame];
[pickerView setTitle:@"FRED" forState:UIControlStateNormal];
[pickerView setTitle:@"Go Back" forState:UIControlStateNormal];
[pickerView setTitleColor:[UIColor blackColor] forState:UIControlEventTouchDown];
pickerView.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
pickerView.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
//[removeButton addTarget:self action:@selector(buttonEvent:) forControlEvents:UIControlEventTouchDown];
[pickerView setBackgroundColor:[UIColor blueColor]];
[menu addSubview:pickerView];
[menu showInView:self.view];
[pickerView release];
[menu release];
看到我上面的修改。添加一個xib聽起來不錯,你能給我這個代碼嗎?另外,連接按鈕並確保操作表上的筆尖下面沒有任何東西? – Jules 2010-10-05 12:59:06
我發現這個http://stackoverflow.com/questions/2616047/how-to-display-custom-view-in-uiactionsheet,但ActionSheetController丟失 – Jules 2010-10-05 13:05:22
彼得你能提供更多的幫助嗎? – Jules 2010-10-05 15:01:35