小编Shu*_*rma的帖子

AVErrorInvalidVideoComposition = -11841

我正在合并多个视频和多首歌曲,因为相同的代码昨天运行得非常好,但是今天我得到了以下的响应 AVAssetExportSessionStatus = 4,error = Error Domain=AVFoundationErrorDomain Code=-11841 "The operation couldn’t be completed. (AVFoundationErrorDomain error -11841.)" 我做了一些研究,发现导出失败了视频合成无效.请查看视频合成有什么问题.

- (void)mergeAllselectedVideos
{
    NSArray *pathArray = [DocumentDirectory getUrlFromDocumentDirectoryOfList:self.selectedClipsArray];
    AVMutableComposition *mixComposition = [[AVMutableComposition alloc]init];
    NSMutableArray *layerinstructions = [[NSMutableArray alloc]init];
    CMTime time = kCMTimeZero;
    CMTime previousSongDuration = kCMTimeZero;
    for (int i = 0 ; i < pathArray.count; i++)
    {
        //VIDEO TRACK//
        time = CMTimeAdd(time, previousSongDuration);
        NSURL *url = [NSURL URLWithString:[pathArray objectAtIndex:i]];
        AVAsset *avAsset = [AVAsset assetWithURL:url];
        AVMutableCompositionTrack *track = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
        [track insertTimeRange:CMTimeRangeMake(kCMTimeZero, avAsset.duration) …
Run Code Online (Sandbox Code Playgroud)

arrays iphone objective-c ios ios5

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

如何重新加载UIViewController

我想重新加载tabbar控制器(UIViewController)中包含的所有视图.搜索后我发现我要应用setNeedsDisplay方法,但我无法在哪里应用它.还欢迎其他任何替代方案

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    .....
    .....

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    [self customToolbar];
    [self.window addSubview:tabBarController.view];
    [self.window makeKeyAndVisible];    
    return YES;
}
-(void)customToolbar
{
    //Declared view controllers and their Navigation Controller
    .....

    //Declared tab bar items
    .....    

    tabBarController = [[GTabBar alloc] initWithTabViewControllers:viewControllersArray tabItems:tabItemsArray initialTab:1];
}
Run Code Online (Sandbox Code Playgroud)

iphone xcode iphone-sdk-3.0 ios4 ios

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

如何从UIImage获取URL

如何从UIImage获取URL?我有一个来自iPhone库的图像,我调整了它的大小,我不想保存新图像,但我想得到它的URL.

iphone objective-c ios4 ios ios5

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

NSString到HTML

我在UIWebview中显示NSString以显示带有自定义表情符号(图像)的文本但我遇到了麻烦,因为UIWebview无法检测特殊字符,如\n,\ r,\ t,空格,&,<,>和更多的字符串.如何将NSString转换为HTML字符串以在UIWebView中加载?

html iphone objective-c uiwebview ios

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

如何从子视图的View Controller设置导航栏的标题?

我有一个视图控制器,在启动时有导航栏.
在一些UIViewConrollers之后,我添加了一个tabbar控制器,我为每个标签栏创建了四个标签栏和四个视图控制器.
现在如果我创建带有与每个选项卡相关的导航栏的标签栏,它会在顶部显示两个导航栏,如果创建没有导航栏的标签栏,它将只显示一个标签栏,但我无法将与每个标签视图控制器对应的标题添加到该导航bar
这是我创建标签栏的代码

EventDetailViewController *firstViewController = [[EventDetailViewController alloc]init];
firstViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Home" image:[UIImage imageNamed:@"Multimedia-Icon-Off.png"] tag:2]autorelease];                                 MoreInfo *secondViewController = [[MoreInfo alloc]init];
secondViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Info" image:[UIImage imageNamed:@"Review-Icon-Off.png"] tag:0]autorelease];

PlaceInfoViewController *thirdViewController = [[PlaceInfoViewController alloc]init];
thirdViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Lugar" image:[UIImage imageNamed:@"Place-icon-OFF.png"] tag:1]autorelease];

FavoritesViewController *forthViewController = [[FavoritesViewController alloc]init];
forthViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Compartir" image:[UIImage imageNamed:@"Compartir-Icon-Off.png"] tag:3]autorelease];

UITabBarController *tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
tabBarController.viewControllers = [[NSArray alloc] initWithObjects:firstViewController, secondViewController, thirdViewController, forthViewController, nil];
tabBarController.view.frame = self.view.frame;
[self.view addSubview:tabBarController.view];

[firstViewController release];
[secondViewController release];
[thirdViewController release];
[forthViewController …
Run Code Online (Sandbox Code Playgroud)

iphone iphone-sdk-3.0 ios4 ios

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

如何获取保存在文档目录中的视频的缩略图

我将捕获的视频保存在文档目录中,如下所示,现在我想显示缩略图并播放相同的视频.如何做到这一点?

- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info

{    
    NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];

    [self dismissModalViewControllerAnimated:NO];

// Handle a movie capture
if (CFStringCompare ((__bridge_retained CFStringRef) mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo)
{
    NSArray  *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir  = [documentPaths objectAtIndex:0];
    NSString *movieName = [NSString stringWithFormat:@"%@.mov",[CoreDataFunctions getNameForVideoForDate:[CalendarFunctions getCurrentDateString]]];
    NSString *moviePath    = [documentsDir stringByAppendingPathComponent:movieName];
    NSURL * movieURL = [info valueForKey:UIImagePickerControllerMediaURL];
    NSData * movieData = [NSData dataWithContentsOfURL:movieURL];
    NSLog(@"%@",moviePath);
    if([movieData writeToFile:moviePath atomically:NO])
    {
        if(![CoreDataFunctions saveVideoInfoInDatabaseForDate:[CalendarFunctions getCurrentDateString]])
        {
            NSLog(@"Video …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios4 ios ios5

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

为所有navigationcontroller和navigationitem设置titleview

[[[UINavigationBar appearance] setTitleView:button]
Run Code Online (Sandbox Code Playgroud)

我尝试使用上面的代码行将标题视图设置为所有导航项的按钮,但它不起作用.如何通过在appdelegate中编写小代码来为项目中的所有导航栏设置标题视图?

iphone objective-c uinavigationbar uinavigationcontroller ios

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