
你能控制文本的大小和它在操作表上的对齐方式吗?另外,你能决定destructivebutton和其他按钮在动作单上的出现顺序吗?像屏幕一样的截图是我试图创建的。
提前感谢
发布于 2010-10-19 21:12:37
我做了一些类似的事情来定制一个Action Sheet:
-(void) showPopup { unitPicker *pc = [unitPicker alloc ];UIActionSheet *popupQuery = [UIActionSheet alloc:@“Units”delegate:pc cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil ];
[pc setParent:self];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQuery showInView:self.view];
[popupQuery setBounds:CGRectMake(0,0,320, 350)];
[pc setAs:popupQuery];
[popupQuery addSubview:pc.view];}
诀窍在于"unitPicker“是从UIControllerView派生出来的,但是实现了UIActionSheetDelegate协议。它提供了两个函数:
- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex;
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex;来处理任何清理工作。最重要的一点是,与任何UIViewController一样,unitPicker的格式也是从一个NIB创建的。
视图中的按钮使用其touchUpInside处理程序中的代码解除了actionSheet:
[as dismissWithClickedButtonIndex:0 animated:TRUE];(您可以在上面的代码中看到,"as“被设置为actionSheet对象)。
https://stackoverflow.com/questions/3967992
复制相似问题