我需要在Tab Bar控制器上方显示操作表.我的意思是,即使操作表视图处于可见模式,我也能看到Tab Bar控制器.
因此,请建议如何从Tab Bar控制器上方查看.可能吗.
其次,如何更改动作表的背景颜色和取消按钮背景颜色.
请帮我
谢谢,Madan Mohan.
我有一个名为-showMoreTools的方法:它是:
- (IBAction) showMoreTools:(id)sender {
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"Close" otherButtonTitles:@"Add Bookmark", @"Add to Home Screen", @"Print", @"Share", nil];
popupQuery.actionSheetStyle = UIActionSheetStyleDefault;
popupQuery.dismiss
[popupQuery showFromBarButtonItem:moreTools animated:YES];
[popupQuery release];
}
Run Code Online (Sandbox Code Playgroud)
当用户点击UIBarButtonItem它时会显示该信息UIActionSheet,但是,如果用户想要关闭而UIActionSheet没有点击关闭按钮,(点击UIBarButtonItem,则显示UIActionSheet在第一个上方UIActionSheet.
有可能以某种方式实现另一个时间UIBarButtonItem来关闭UIActionSheet?
非常感谢你 - 我是iOS编程的新手!
我在整个应用程序中使用绿色作为"动作颜色",我希望我的UIActionSheets中的选项也是绿色的,以保持一致性.如何将UIActionSheet选项的颜色从蓝色更改为绿色?
我创建了一个操作表,但问题是没有调用委托方法
myActionSheet = UIActionSheet()
myActionSheet.addButtonWithTitle("Add event")
myActionSheet.addButtonWithTitle("close")
myActionSheet.cancelButtonIndex = 1
myActionSheet.showInView(self.view)
Run Code Online (Sandbox Code Playgroud)
/// UIActionSheetDelegate
func actionSheet(myActionSheet: UIActionSheet!, clickedButtonAtIndex buttonIndex: Int){
if(myActionSheet.tag == 1){
if (buttonIndex == 0){
println("the index is 0")
}
}
}
Run Code Online (Sandbox Code Playgroud)
我使用了另一种适用于iOS 8的方法但不适用于iOS 7:
var ActionSheet = UIAlertController(title: "Add View", message: "", preferredStyle: UIAlertControllerStyle.ActionSheet)
ActionSheet.addAction(UIAlertAction(title: "Add event", style: UIAlertActionStyle.Default, handler:nil))
self.presentViewController(ActionSheet, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
有什么想法解决这个问题吗?
我将我所有的UIActionSheet和UIAlertView带UIAlertController。
我的问题是当我尝试呈现UIAlertControllerActionSheet样式时。这是我的代码:
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Title"
message:@"My message"
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:cancelAction];
UIAlertAction *OKAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:OKAction];
UIAlertAction *destroyAction = [UIAlertAction actionWithTitle:@"Destroy" style:UIAlertActionStyleDestructive handler:nil];
[alert addAction:destroyAction];
UIPopoverPresentationController *popPresenter = [alert popoverPresentationController];
popPresenter.sourceView = self.view;
popPresenter.sourceRect = self.view.bounds;
[self presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
这是错误:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you …Run Code Online (Sandbox Code Playgroud) iOS SDK中UIActionSheet的Android等价是什么?我正在研究React-Native项目,并且需要尽可能保持本机控件的使用.我没有遇到使用相应的plartform'动作表'的npm包或其他包.他们似乎都使用iOS中的原生动作表,以及Android的iOS动作表的javascript模拟(这使得它在Android上非原生).如果我能知道android显示哪个iOS显示动作表,那么我可以使用适用于Android的RN Android组件和iOS的动作表.我希望这是一个明确的问题.
字体非常小,有些人难以阅读,所以我想让它更接近下面按钮上使用的字体大小.
我的程序编译成功,但是当我按下按钮时,它会崩溃.这是viewController.swift:
import UIKit
class ViewController: UIViewController, UIActionSheetDelegate{
@IBOutlet var button:UIButton
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func buttonPressed(AnyObject) {
let choice = UIActionSheet(title: "Select source", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: nil, otherButtonTitles:"camera", "libary")
choice.showInView(self.view)
}
}
Run Code Online (Sandbox Code Playgroud)
错误出现在这一行:
let choice = UIActionSheet(title: "Select source", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: nil, otherButtonTitles:"camera", "library") …Run Code Online (Sandbox Code Playgroud) 我正在将iOS应用程序表单UIWebView迁移到WKWebView.到目前为止一直这么好......在之前的应用程序中我禁用了长按并实现了自定义长按(自定义处理链接),但是我无法在WKWebView中使用它
我尝试过以下方法:
- (void)webView:(WKWebView *)wkWebView didFinishNavigation:(WKNavigation *)navigation {
[wkWebView evaluateJavaScript:@"document.body.style.webkitTouchCallout='none';" completionHandler:nil];
}
Run Code Online (Sandbox Code Playgroud)
我已检查并且该行被执行,该呼叫的响应为@"无"
但它响应:警告:尝试显示其视图不在窗口层次结构中!
有任何想法吗? 解决方案:将 javascript注入wkwebview现在可以正常工作!
[self.wkWebView evaluateJavaScript:@"document.body.style.webkitTouchCallout='none';" completionHandler:nil];
Run Code Online (Sandbox Code Playgroud) 是否可以绕过行动共享表将照片分享给Instagram?
请注意,我知道的UIDocumentInteractionController和挂钩,事实上它工作正常.通过他们的示例代码,您可以获得一个Copy to Instagram选项(如果您使用独家UTI或可以处理JPG/PNG的大量应用程序,以及Instagram,则可以选择).
这很好,但我想知道是否有办法执行"复制到Instagram"操作,而无需UIDocumentInteractionController在iOS 9+中显示菜单.
为了记录,这是完美运行的代码的简化版本.假设你有一个有效的NSURL ......
guard let data: NSData = NSData(contentsOfURL: url),
image = UIImage(data: data) else {
return
}
let imageData = UIImageJPEGRepresentation(image, 100)
let captionString = "caption"
let writePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("instagram.ig")
guard let _ = imageData?.writeToFile(writePath, atomically: true) else {
return
}
let fileURL = NSURL(fileURLWithPath: writePath)
self.documentController = UIDocumentInteractionController(URL: fileURL)
self.documentController.delegate = self
self.documentController.UTI = "com.instagram.photo"
self.documentController.annotation = NSDictionary(object: captionString, forKey: "InstagramCaption") …Run Code Online (Sandbox Code Playgroud) uiactionsheet ×10
ios ×5
iphone ×3
objective-c ×3
swift ×3
ios7 ×2
android ×1
font-size ×1
instagram ×1
ios8 ×1
ipad ×1
native ×1
react-native ×1
wkwebview ×1
xcode ×1