小编sar*_*nar的帖子

UIAlertController如何在obj c中添加标记值

用于UIAlertView

- (void) alertStatus:(NSString *)msg :(NSString *)title :(int) tag
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
                                                        message:msg
                                                       delegate:self
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil, nil];
    alertView.tag = tag;
    [alertView show];
}
Run Code Online (Sandbox Code Playgroud)

但现在UIAlertView被弃用了.改变我的代码

 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction* MyAlert = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
    [alertController addAction:MyAlert];
   [self presentViewController:alertController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

这里如何传递这个标签值

alertView.tag = tag;
Run Code Online (Sandbox Code Playgroud)

帮助如何在UIAlertController中传递标记值.谢谢你.

iphone objective-c uialertview ios

5
推荐指数
1
解决办法
3545
查看次数

如果TouchID失败,请转发到系统密码验证

我想使用TouchID验证我的应用程序,验证成功.如果TouchID不匹配,则会打开"再试一次"警报,并在该警报中输入"密码"选项.如果用户选择该选项,则应显示系统密码验证,但我该怎么办呢?

在这里分享我的代码:

func touchIDAuthentication() {
    let context = LAContext() //1
    var error:NSError?
    guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
        showAlertViewIfNoBiometricSensorHasBeenDetected()
        return
    }
    if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &errorPointer) {
        context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason, reply: { (success, error) in
            if success {
                DispatchQueue.main.async {
                    print("Authentication was successful")
                }
            }else {
                DispatchQueue.main.async {
                    self.displayErrorMessage(error: error as! LAError )
                    print("Authentication was error")
                }
            }
        })
    }else {
        self.showAlertWith(title: "Error", message: (errorPointer?.localizedDescription)!)
    }
}



func displayErrorMessage(error:LAError) {
        var message = ""
        switch error.code {
        case LAError.authenticationFailed:
            message = …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch ios touch-id swift localauthentication

5
推荐指数
2
解决办法
5742
查看次数

选择在ios swift中的数组中的uitableview部分中取消选择收音机

在tableview中有不同的部分。

要为所有部分添加单选按钮。

每个部分在表格视图中都有单独的选择和取消选择。

在第一部分的选择1中,[如图所示]

选中的奶酪表示要选择奶酪,如果用户单击培根,则表示奶酪自动取消选择。

[这里使用单选按钮SSRadioButton类进行单击操作。在表格视图单元格中创建一个单选按钮。如何编写单选按钮的按钮动作。或建议任何新方法]。

每个单选按钮都需要单独选择和取消选择。表格视图中所有部分的处理相同。怎么可能帮助我。谢谢前进。在此处输入图片说明

我的代码:

 var radioControllerChoice : SSRadioButtonsController = SSRadioButtonsController()
    var radioControllerDip : SSRadioButtonsController = SSRadioButtonsController()

func numberOfSections(in tableView: UITableView) -> Int {
        return table_data.count
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // Return the number of rows in the section.
        return table_data[section].menu_id.count
    }

 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let cell:CustomiseTableViewCell = tableView.dequeueReusableCell(withIdentifier: "Customise") as! CustomiseTableViewCell
        cell.name.text?=table_data[indexPath.section].menu_name[indexPath.row]
        print(table_data[indexPath.section].customize[indexPath.row])

        switch indexPath.section {
        case 2:
            radioControllerChoice.addButton(cell.radioBtn)
            radioControllerChoice.shouldLetDeSelect = false …
Run Code Online (Sandbox Code Playgroud)

radio-button tableview sections swift

4
推荐指数
1
解决办法
7714
查看次数

iOS Swift:如何检查端口是否打开

在我的应用程序中想要检查端口是否打开。这里参考这个链接

iOS SDK:如何检查端口是否打开?

但是没有得到任何解决方案。并参考这两个github源,

https://github.com/swiftsocket/SwiftSocket

https://github.com/robbiehanson/CocoaAsyncSocket

但是没有任何解决方案。任何人都可以帮助检查端口是否打开。谢谢提前。

sockets port asyncsocket ios swift

1
推荐指数
1
解决办法
1825
查看次数

WKWebView禁用缩放和快速编辑

在该Web视图中使用WKWebView加载URL不能禁用缩放和编辑。这是我的代码。

 [myWebView = WKWebView(frame: CGRect( x: 0, y: 20, width: self.view.frame.width, height: self.view.frame.height - 20 ), configuration: WKWebViewConfiguration() )
        myWebView.translatesAutoresizingMaskIntoConstraints = false
        myWebView.navigationDelegate = self
        myWebView.uiDelegate = self
        self.myWebView.isMultipleTouchEnabled = false
        view = myWebView
        myWebView.scrollView.showsHorizontalScrollIndicator = false;
        myWebView.scrollView.showsVerticalScrollIndicator = false;

        myWebView.uiDelegate = self
        myWebView.navigationDelegate = self
        myWebView.scrollView.delegate = self


        myWebView.scrollView.bounces = false
        myWebView.scrollView.bouncesZoom = true
        myWebView.isMultipleTouchEnabled = false

      func viewForZooming(in: UIScrollView) -> UIView? {
        return nil;
      }
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

在此处输入图片说明

如何删除编辑和缩放打开。帮我谢谢前进。

uiwebview ios swift wkwebview

0
推荐指数
2
解决办法
4848
查看次数