Your application has presented a UIAlertController of style UIAlertControllerStyleActionSheet.

提交app时,如果苹果那边是用pad测试,点到了UIAlertController,可能会报错,拒绝原因

错误提示:

Your application has presented a UIAlertController of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller’s popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.

也就是说iphone有的样式,ipad不一定有。

更改方法,就是在present之前叫一个判断,做出不同样式的布局,苹果已经为我们提供好了方法

{

       ……

      if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad {

            actionSheet.popoverPresentationController?.sourceView = self.view //要展示在哪里

            actionSheet.popoverPresentationController?.sourceRect = self.headerV.nameLb.frame //箭头指向哪里

        }

        present(actionSheet, animated: true, completion: nil)

}

Here's an example of inline assembler code that calculates the length of a string: ```c #include <stdio.h> int main() { char str[] = "Hello, world!"; int len; asm volatile ( "movl $0, %0\n\t" // initialize counter to 0 "1:\n\t" "movb (%1), %%al\n\t" // load next character into al "cmpb $0, %%al\n\t" // compare with null terminator "je 2f\n\t" // if equal, jump to end "incl %0\n\t" // increment counter "incl %1\n\t" // increment pointer "jmp 1b\n\t" // jump to beginning of loop "2:\n\t" : "=r" (len) // output: len = counter : "r" (str) // input: str = pointer to string : "%eax" // clobbered register: eax ); printf("Length of string: %d\n", len); return 0; } ``` Explanation: - The `asm volatile` statement tells the compiler that this is inline assembler code that may modify registers and memory, and that it should not optimize or reorder instructions. - The `movl $0, %0` initializes the counter to 0 and assigns it to the output variable `len`. - The label `1:` marks the beginning of a loop that processes each character of the string. - The `movb (%1), %%al` instruction loads the next character into the `al` register. - The `cmpb $0, %%al` instruction compares the character with the null terminator. - The `je 2f` instruction jumps to the label `2:` if the character is a null terminator. - The `incl %0` instruction increments the counter. - The `incl %1` instruction increments the pointer to the next character. - The `jmp 1b` instruction jumps back to the beginning of the loop. - The label `2:` marks the end of the loop. - The output operand `=r` (len) tells the compiler that `len` is an output variable that will be stored in a register. - The input operand `"r" (str)` tells the compiler that `str` is an input variable that will be stored in a register. - The clobbered register `%eax` tells the compiler that the `eax` register may be modified by the inline assembler code.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值