我有任务输入评级(1 - 5)值,所以我找到了以下代码的日期选择器,任何人都可以帮我改变下面的代码,以便添加UIPickerView选择从1到5的速率
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Ratings"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil];
UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;
[menu addSubview:pickerView];
[menu showInView:self.view];
[menu sendSubviewToBack:pickerView];
[menu setBounds:CGRectMake(0,0,320, 500)];
CGRect pickerRect = pickerView.bounds;
pickerRect.origin.y = -100;
pickerView.bounds = pickerRect;
[pickerView release];
[menu release];
Run Code Online (Sandbox Code Playgroud)
该做什么,所以评级的文本字段将自动输入UIPIckerView中的选定值
谢谢
我正在使用代码:
Run Code Online (Sandbox Code Playgroud){ randomstatus=0; msg=[[NSString alloc]initWithFormat:@"Good job, do you want to continue?"]; UIActionSheet *actionSheet=[[UIActionSheet alloc]initWithTitle:msg delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil]; [actionSheet showInView:self.view]; [actionSheet release]; [msg release]; }
我不想更改代码,但我需要"destructiveButton"为绿色而不是红色.这是可能的,还是我需要使用不同的按钮?
如果只有一个方法,多个UIActionSheets 如何添加到UIViewController单个-actionSheet:clickedButtonAtIndex:?
我正在尝试从应用程序委托中删除UIActionSheet,以便在从后台返回时不再显示它.我试图从子类视图控制器中的viewDidUnload或viewDidDisappear方法中删除操作表,但在应用程序背景时似乎没有调用.
因此,我正在尝试使用应用程序委托来解雇UIActionSheet可能在应用程序背景时显示的内容.但我无法弄清楚该怎么称呼.有没有人有办法解决吗?或者更好的想法来完成同样的事情?
谢谢.
在UIActionSheet中,我有一个uitableview和取消按钮.默认情况下,取消按钮显示在顶部.我想让它在tableview后显示在底部.我怎么做?
我注意到iOS 7 a **UIActionSheet** automatically dismisses了user taps anywhere on the screen on an **iPhone**.这不是iOS 6中的情况,并且导致意想不到的效果.Is this a UI change? Bug? Is there a way to disable this?
来自iOS 7文档:
"如iOS人机界面指南中所述,您应该在iPhone上显示一个带有操作表的取消按钮,并在iPad上通过打开的弹出窗口显示这些操作页.否则,在iPad上,操作表会显示在弹出窗口中,并且用户可以通过点击弹出窗口外部取消操作表,在这种情况下,您不需要包含"取消"按钮."
这似乎表明,当点击操作表外的任何地方时,解雇的行为应仅适用于iPad.但现在这种情况发生在运行iOS 7的iPhone上,而不是在运行iOS 6的iPhone上运行
我想知道是否有人知道一种创建 UIAlertController 作为操作表的方法,该操作表看起来像 iOS 8.4 中新音乐应用程序中的操作表
\n\n我想要的是将按钮分成几组,如下图所示。正如您所看到的,“Crear una lista Genius”和“A\xc3\xb1adir a una lista...”之间有一个空格。
\n\n谢谢。
\n\n
我UIActionSheet在我的视图中呈现了一个,其中一个操作表的按钮显示了另一个操作表.当我在iPad上展示第二个操作表时,我在日志中收到此警告消息:
要求UIPopoverBackgroundVisualEffectView为其不透明度设置动画.这将导致效果出现断裂,直到不透明度返回到1.
这是我的代码:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Option"] delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Sort", nil];
actionSheet.tag = 1;
[actionSheet showInView:self.view];
Run Code Online (Sandbox Code Playgroud)
在代表中:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
[self showSortAction];
}
-(void)showSortAction {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Sort By" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"A-Z", @"Z-A", @"Newer to older", @"Older to newer", nil];
actionSheet.tag = 2;
[actionSheet showInView:self.view];
}
Run Code Online (Sandbox Code Playgroud) 我想使用变量在视图中调用不同的操作表。这并不意味着工作。
.actionSheet(isPresented: self.$neuinitialisierung) {
ActionSheet(
title: Text("Testtitel 1"),
message: Text("Testmessage 1"),
buttons: [
.default(Text("Button 1"),
action: {
print("KLICK")
}),
.default(Text("Button 2"),
action: {
self.clouddienst_waehlen = true;
})
])
}
.actionSheet(isPresented: self.$clouddienst_waehlen) {
ActionSheet(
title: Text("Testtitel 2"),
message: Text("Testmessage 2"),
buttons: [
.default(Text("Button 1"),
action: {
print("KLICK")
}),
.default(Text("Button 2"),
action: {
self.clouddienst_waehlen = true;
})
])
}
Run Code Online (Sandbox Code Playgroud)
如果我只用一张动作表尝试它,它就会起作用。我怎样才能使用第二个?
我创建了一个 SwiftUI 视图,它显示在 MKMapView 的注释标注中。我使用 UIHostingController 来包装 SwiftUI 视图,并使用 annotationView 的detailCalloutAccessoryView属性来设置视图并显示它。这在大多数情况下工作正常。然后我在 SwiftUI 视图中添加了一些按钮,当点击这些按钮时需要显示警报或操作表。
这是代码:
struct ContactProfileButton: View {
@State var showActionSheet: Bool = false
var body: some View {
Button(action: {
print("Profile button tapped!")
self.showActionSheet.toggle()
}){
Image("profile").resizable()
}.frame(width: 26.0, height: 26.0)
.actionSheet(isPresented: $showActionSheet, content: {
print("Profile button - show action sheet")
return ActionSheet(title: Text("Profile title"),
message: Text("Profile message"),
buttons: [
.default(Text("Do something")),
.destructive(Text("Cancel"))
])
})
}
}
Run Code Online (Sandbox Code Playgroud)
当我点击按钮时,它工作正常并显示一个操作表,但在控制台中生成此警告:
[演示]不鼓励从分离的视图控制器 < TtGC7SwiftUI19UIHostingControllerVS_7AnyView : 0x7fac1fac8280>呈现视图控制器 <SwiftUI.PlatformAlertController: 0x7fac118b3a00> 。
解决此警告的最佳方法是什么?如果在 UIHostingController …
uiactionsheet ×10
iphone ×4
cocoa-touch ×3
ios ×3
swiftui ×2
button ×1
cocoa ×1
dismiss ×1
ios7 ×1
ipad ×1
objective-c ×1
uikit ×1
uipickerview ×1
uiview ×1
xcode ×1