我使用下面的代码在视频上添加图像叠加,然后将新生成的视频导出到文档目录.但奇怪的是,视频旋转了90度.
- (void)buildTransitionComposition:(AVMutableComposition *)composition andVideoComposition:(AVMutableVideoComposition *)videoComposition
{
CMTime nextClipStartTime = kCMTimeZero;
NSInteger i;
// Make transitionDuration no greater than half the shortest clip duration.
CMTime transitionDuration = self.transitionDuration;
for (i = 0; i < [_clips count]; i++ ) {
NSValue *clipTimeRange = [_clipTimeRanges objectAtIndex:i];
if (clipTimeRange) {
CMTime halfClipDuration = [clipTimeRange CMTimeRangeValue].duration;
halfClipDuration.timescale *= 2; // You can halve a rational by doubling its denominator.
transitionDuration = CMTimeMinimum(transitionDuration, halfClipDuration);
}
}
// Add two video tracks and two audio tracks. …
Run Code Online (Sandbox Code Playgroud) 我可以绘制曲线,但不是很平滑.事实上,它完全分散注意力和波浪状.任何人都可以帮助我或建议一种使曲线平滑的方法吗?
提前致谢.
我有一个popoverview问题,而点击并打开相机的ipad,我写了这样的代码
-(IBAction)business_takephotobtnClicked // click the button show the popoverview
{
NSLog(@"business_takephotobtnClicked");
appdelegate.takePhoto=2;
popover = [[UIPopoverController alloc]
initWithContentViewController:imgclass];
popover.popoverContentSize = CGSizeMake(138,66);
[popover presentPopoverFromRect:popbtn_business.bounds inView:popbtn_business
permittedArrowDirections:UIPopoverArrowDirectionUp +
UIPopoverArrowDirectionLeft
animated:YES];
}
-(IBAction) takePhoto:(id)sender // to open the camera
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
self.contentSizeForViewInPopover=CGSizeMake(138,66);
UIPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:self.UIPicker animated:YES];
}
else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Camera is not available" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
Run Code Online (Sandbox Code Playgroud)
在单击按钮之前,弹出窗口就像那个节目一样
点击拍照(Neem照片按钮).POPOVERVIEW SIZE自动扩展为taht
但我也需要一个相同尺寸的popoverview同时打开相机
提前致谢......
我试图通过在视图加载后来回改变alpha级别来制作一个有图像的uibutton缓慢脉动...
目前我这样做但它没有做任何事....
-(void)loopdyloop
{
while ( myCount < 1000 )
{
[UIView animateWithDuration:3.0
delay:0.0f
options:UIViewAnimationCurveEaseOut
animations:^{
iconButton.alpha = 0.0;
} completion:^(BOOL finished) {
if (finished) {
NSLog(@"animated");
}
}];
[UIView animateWithDuration:3.0
delay:0.0f
options:UIViewAnimationCurveEaseOut
animations:^{
iconButton.alpha = 1.0;
} completion:^(BOOL finished) {
if (finished) {
NSLog(@"animated");
}
}];
myCount++;
}
}
Run Code Online (Sandbox Code Playgroud)
从viewdidload方法调用此方法,
我知道但是我最好的尝试,如果你对如何实现这一点有任何想法,我将不胜感激.
一直试图让它工作一段时间知道我已经尝试过使用数据和流媒体但没有运气,我认为我不需要像大多数示例中所示创建存储桶,因为我想上传到的存储桶已经存在,它还告诉我我试图访问的存储桶,但是当我尝试上传时,我得到了这个
“将图像上传到 S3 时出错:您提供的 XML 格式不正确或未根据我们发布的架构进行验证”
这是代码
UIImage * img = [[[[CurrentGamesInfo sharedCurrentGamesInfo]GameInCreation] GetImageToSend]_imageToSend];
NSData *savedImageData = UIImageJPEGRepresentation(img, 0.8);
NSString *pictureName = [[[CurrentGamesInfo sharedCurrentGamesInfo]GameInCreation] GetGameID];
@try
{
AmazonS3Client *s3 = [[[AmazonS3Client alloc] initWithAccessKey:MY_ACCESS_KEY_ID withSecretKey:MY_SECRET_KEY] autorelease];
//[s3 createBucket:[[[S3CreateBucketRequest alloc] initWithName:MY_PICTURE_BUCKET] autorelease]];
NSArray *bucketArray = [s3 listBuckets];
S3Bucket *bucket = [[s3 listBuckets] objectAtIndex:0];
NSLog(@"%@",[bucket name]);
S3PutObjectRequest *por = [[[S3PutObjectRequest alloc] initWithKey:pictureName inBucket:MY_PICTURE_BUCKET] autorelease];
por.contentType = @"image/jpeg";
//por.data = savedImageData;
//por.cannedACL = [S3CannedACL publicRead];
S3UploadInputStream *stream = [S3UploadInputStream inputStreamWithData:savedImageData];
//stream.delay = 0.2;
//stream.packetSize …
Run Code Online (Sandbox Code Playgroud)