小编Has*_*ssy的帖子

iOS 11 - 键盘高度在键盘通知中返回0

我一直在使用键盘通知没有任何问题,并获得键盘的准确高度.

- (void)keyboardDidShow:(NSNotification *) notification{
    CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

    NSLog(@"%f",keyboardSize.height);}
Run Code Online (Sandbox Code Playgroud)

但是在iOS 11中,调用通知时键盘的大小为0.

这种情况下出现的问题是什么?我正在使用xcode 9 Beta 5

objective-c nsnotificationcenter ios

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

UIBarButtonItem UINavigationBar中的自定义视图

我正在为uinavigationbar制作自定义栏按钮,我正在使用以下代码

 UIImageView *backImgView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"chk_back.png"]]; [backImgView setUserInteractionEnabled:YES];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:backImgView];
[backButton setTarget:self];
[backButton setAction:@selector(BackBtn)];
checkIn_NavBar.topItem.leftBarButtonItem = backButton;
Run Code Online (Sandbox Code Playgroud)

问题是它没有调用它的行动.我做错了什么?

objective-c uinavigationbar uibarbuttonitem ios

18
推荐指数
1
解决办法
3万
查看次数

Xcode 14 - 无法进行代码签名,因为目标没有 Info.plist 文件

我在我的项目中使用cocoapods,它工作正常,但升级到 Xcode 14 后,它给出了不同的类型或错误。

首先它要求提供位代码,后来要求开发团队提供,我使用 podfile 中的以下脚本解决了这个问题

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      #config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
      config.build_settings['ENABLE_BITCODE'] = 'YES'
      config.build_settings["DEVELOPMENT_TEAM"] = " Your Team ID "
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

解决这些错误后,另一个错误开始出现,即

错误构建:无法进行代码签名,因为目标没有 Info.plist 文件并且不会自动生成。使用 INFOPLIST_FILE 构建设置将 Info.plist 文件应用到目标,或者通过将 GENERATE_INFOPLIST_FILE 构建设置设置为 YES(推荐)来自动生成一个 Info.plist 文件。

我的豆荚已更新,可可豆荚版本是1.11.3。我该如何解决这个错误?

编辑:

这里提到了一些细节,但没有一个对我有用。

cocoapods xcode14

18
推荐指数
2
解决办法
2万
查看次数

具有关联值的枚举案例不能用“@available”标记为可能不可用

我在Xcode 13上收到以下代码的错误消息

@available(iOS 13.0, *)
    case windowScene(_: UIWindowScene, windowLevel: UIWindow.Level)
Run Code Online (Sandbox Code Playgroud)

具有关联值的枚举案例不能用“@available”标记为可能不可用

有谁知道我为什么会收到此错误以及纠正该错误的解决方案是什么?它在 Xcode 12 中运行良好。

xcode swift xcode13

11
推荐指数
2
解决办法
1万
查看次数

允许使用AFNetworking的无效证书

我一直在使用以下代码

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request];
operation.allowsInvalidSSLCertificate=YES;
Run Code Online (Sandbox Code Playgroud)

现在我已将AFNetworking更改为2.0的最新版本.operation.allowsInvalidSSLCertificate不与工作了AFHTTPRequestOperation.根据我使用的文件

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.securityPolicy.allowInvalidCertificates = YES;
Run Code Online (Sandbox Code Playgroud)

我的请求代码是

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request];

[operation  setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {

    NSLog (@"success: %@", operation.responseString);

}
                                  failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                                      NSLog(@"error: %@",  error.description);
                                  }
 ];

[operation start];
[operation waitUntilFinished];
Run Code Online (Sandbox Code Playgroud)

但这不适用于需要证书的HTTPS.我应该怎么做才能使这项工作?

objective-c ios afnetworking-2

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

iOS 13-UIPopoverPresentationController sourceview内容在箭头中可见

当我在UIPopoverPresentationController中显示一些视图并将其显示为弹出窗口时

popoverCon?.modalPresentationStyle = UIModalPresentationStyle.popover
Run Code Online (Sandbox Code Playgroud)

内容已向上移动,并且箭头中显示了一部分。

在此处输入图片说明

此外,我在弹窗周围有边界

popoverCon?.view.layer.borderColor = .orange
popoverCon?.view.layer.borderWidth = 1.0;
popoverCon?.view.layer.cornerRadius = 10.0;
popoverCon?.view.layer.masksToBounds = false;
Run Code Online (Sandbox Code Playgroud)

它没有朝着箭头所在的部分显示,但在箭头的尖端显示了少许边界线。

在此处输入图片说明

在iOS 12之前,它一直工作良好,但在iOS 13中,此问题即将出现。

关于如何解决这个问题有什么建议吗?

popover uipopoverpresentationcontroller ios13

9
推荐指数
3
解决办法
1324
查看次数

touchesMoved在iPhone 6s及以后的单点击中被调用

我有一个自定义UIButton,我已经在自定义按钮类中实现了触摸委托.

在iPhone 6 Plus之前,每件事情都很好.它上面的所有设备如iPhone 6s和7都会产生问题.

当我点击一个按钮touchesBegan被按预期调用,但touchesMoved也被调用,它在我的代码中产生问题.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
     _firstTouch = [[touches anyObject]locationInView:self];
     _isTapped = YES;

     [self.nextResponder.nextResponder  touchesBegan:touches withEvent:event];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
   _isTapped = NO;

   [self.nextResponder.nextResponder touchesMoved:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
if (_isTapped){
    //Functionality
}
Run Code Online (Sandbox Code Playgroud)

为什么要touchesMoved调用这些设备,我该如何解决?

objective-c touchesmoved ios

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

UIView动画警告

我正在使用以下代码

[UIView animateWithDuration:1.0
                      delay:0.05
                    options:UIViewAnimationCurveEaseIn
                 animations:^{

                                  //Code

                 } completion:^(BOOL finished) {}];
Run Code Online (Sandbox Code Playgroud)

我收到以下警告

Implicit conversion from enumeration type 'enum UIViewAnimationCurve' to different enumeration type 'UIViewAnimationOptions' (aka 'enum UIViewAnimationOptions')
Run Code Online (Sandbox Code Playgroud)

怎么解决这个?

objective-c uiview uiviewanimation ios uiviewanimation-curve

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

iOS 13-在更改框架时调用viewDidLayoutSubviews

iOS 13中的viewdidlayoutsubviews中进行了一些更改,导致它在完成其第一次调用(在更改帧上)后在View Controller生命周期的稍后阶段被调用。这在应用程序中产生了一些奇怪的效果。

我观察到的是,在iOS13更改框架之前,不会调用viewdidlayoutsubviews,而在新的iOS 13中,它将被调用。

这是Apple的某种新功能还是某些bug?关于如何停止这种行为有什么建议吗?

ios viewdidlayoutsubviews ios13

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

iOS 13 - VNDocumentCameraViewController 最大扫描次数

公开新的VNDocumentCameraViewController我找不到任何委托或属性来设置最大扫描次数。

有没有人有解决方法或我可以实施的任何想法来限制一次扫描的数量?

computer-vision ios ios13 vndocumentcameraviewcontroller

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