小编Ios*_*per的帖子

iOS 13 UITextView 将 UITextView 转换为图像无法正常工作。在 iOS 12 以下运行良好

如何在 iOS 13 中解决此问题?我正在截取 UITextView 内容大小的屏幕截图。直到 iOS 12 一切正常。但是 iOS 13 以后的问题是它没有截取完整的屏幕截图。下面是iOS 12以下和iOS 13之后的输出图片。 低于 iOS 12

iOS 13

下面是我用来截取 UITextView 屏幕截图的代码:

let textView = UITextView()
UIGraphicsBeginImageContextWithOptions(textView.contentSize, textView.isOpaque, 0.0)
let savedContentOffset: CGPoint = textView.contentOffset
let savedFrame: CGRect = textView.frame
textView.frame = CGRect(x: 0, y: 0, width: textView.contentSize.width, height: textView.contentSize.height)
textView.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
textView.contentOffset = savedContentOffset
textView.frame = savedFrame
UIGraphicsEndImageContext()
Run Code Online (Sandbox Code Playgroud)

我得到了这个问题的解决方案 下面是 更新的工作代码

选项 1:- 下面使用 UILabel 的代码

let SCREEN_WIDTH = UIScreen.main.bounds.size.width
let SCREEN_HEIGHT = UIScreen.main.bounds.size.height
func buttonAction() {
    let …
Run Code Online (Sandbox Code Playgroud)

iphone ios swift ios13

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

我无法从iOS中的Facebook获取用户数据

我是iPhone编程的新手.使用下面的代码我登录到Facebook并获取数据.但是这里的问题是如果点击Loginwithfacebook按钮Facebook对话框打开.我在那之后输入Facebook的用户名和密码如果再次点击相同按钮然后我得到用户数据.但我不想点击双倍的时间.也有一次我登录Facebook.inside应用程序,我想在那时获取用户数据我不再登录直到我点击退出.请给我最好的主意.

-(void)LoginWithFacebookk:(id)sender
{ 
   if (!FBSession.activeSession.isOpen) {

    FBSession *session = [[FBSession alloc] init];
    // Set the active session
    [FBSession setActiveSession:session];
    // Open the session
    [session openWithBehavior:FBSessionLoginBehaviorForcingWebView
            completionHandler:^(FBSession *session,
                                FBSessionState status,
                                NSError *error)
     {


            }];

        }
        else
        {
            NSLog(@"open response");
            FBRequest* friendsRequest = [FBRequest requestForMe];
            [friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,NSDictionary <FBGraphUser> *user,NSError *error) {

                NSString *emailiddd=[NSString stringWithFormat:@"%@",[user objectForKey:@"email"]];

                NSLog(@"%@",emailiddd);
                NSString *post = [NSString stringWithFormat:@"email=%@",emailiddd];

                NSLog(@"%@",post);

     }];
               }
    }
}
Run Code Online (Sandbox Code Playgroud)

iphone facebook-graph-api ios facebook-sdk-3.0

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