首先,我在.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)
但不要称这种方法.
- 如何删除视频中的绿线. 当播放视频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) - 点击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)