小编Vip*_*ini的帖子

iOS:CollectionView里面的ScrollView委托方法没有调用

首先,我在.h文件中设置了委托

@interface ViewController : UIViewController<UICollectionViewDataSource, UIScrollViewDelegate>
Run Code Online (Sandbox Code Playgroud)

之后,只需在集合视图.m文件中调用此方法

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{

    NSLog(@"scrollViewDidScroll");
}
Run Code Online (Sandbox Code Playgroud)

不要称这种方法.

objective-c uiscrollview ios uicollectionview

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

iOS:在视频中裁剪视频奇怪的绿线左侧和底侧

- 如何删除视频中的绿线. 当播放视频2或3次时,视频中显示绿色或混合绿 - 红闪烁线,左视图或底视图或视频中的左下角.

视频裁剪方法.

-(void)cropButton
{
        CGRect cropFrame = self.cropView.croppedImageFrame;

        //load our movie Asset
        AVAsset *asset;
            asset = [AVAsset assetWithURL:[NSURL fileURLWithPath:[self.videoDataArr objectAtIndex:self.selectedIndex-1]]];

        //create an avassetrack with our asset
        AVAssetTrack *clipVideoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];

        //create a video composition and preset some settings
        AVMutableVideoComposition* videoComposition = [AVMutableVideoComposition videoComposition];
        videoComposition.frameDuration = CMTimeMake(1, 30);

        //create a video instruction
        AVMutableVideoCompositionInstruction *instruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
        instruction.timeRange = CMTimeRangeMake(kCMTimeZero, asset.duration);

        AVMutableVideoCompositionLayerInstruction* transformer = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:clipVideoTrack];

        UIImageOrientation videoOrientation = [self getVideoOrientationFromAsset:asset];

        CGAffineTransform t1 = CGAffineTransformIdentity; …
Run Code Online (Sandbox Code Playgroud)

video xcode crop ios avassetexportsession

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

iOS:使用Facebook登录并打开Native Facebook应用程序

  • 我希望在登录时打开facebook应用程序,该应用程序已安装在设备中进行登录验证,但始终在Safari浏览器中打开.

- 点击Facebook按钮

    -(void)loginButtonClicked
        {
            FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

        //    [login setLoginBehavior:FBSDKLoginBehaviorNative];

                [login logInWithReadPermissions:@[@"email"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
                 {
                     if (error)
                     {
                         NSLog(@"Login process error");
                     }
                     else if (result.isCancelled)
                     {
                         NSLog(@"User cancelled login");
                     }
                     else
                     {
                         NSLog(@"Login Success");
                         if ([result.grantedPermissions containsObject:@"email"])
                         {
                             NSLog(@"result is:%@",result);
                             [self fetchUserInfo];
                         }
                         else
                         {
        //                     [SVProgressHUD showErrorWithStatus:@"Facebook email permission error"];
                         }
                     }
                 }];
            }
        }
Run Code Online (Sandbox Code Playgroud)

- 获取用户信息

        -(void)fetchUserInfo
        {
            if ([FBSDKAccessToken currentAccessToken])
            {
                NSLog(@"Token is available : %@",[[FBSDKAccessToken currentAccessToken]tokenString]);

                [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" …
Run Code Online (Sandbox Code Playgroud)

facebook ios

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