我想为我的操作表的按钮中的文本设置更小的字体,因为我的文本比宽度更长。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