小编Moo*_*Soo的帖子

我什么时候使用CFRelease?

我正在学习iOS编程.

我编写了与地址相关联的代码.

有很多方法.喜欢

我正在分组.

这是group1

ABAddressBookCreate();
ABRecordCopyCompositeName(argument);
ABRecordCopyValue(argument1, argument2);
ABRecordCopyValue(argument1, argument2);
ABMultiValueCopyLabelAtIndex(argument1, argument2);
ABMultiValueCopyValueAtIndex(argument1, argument2);
Run Code Online (Sandbox Code Playgroud)

另一个就在这里,group2

CFArrayGetCount(argument);
CFArrayGetValueAtIndex(argument1, argument2);
ABMultiValueGetCount(argument);
Run Code Online (Sandbox Code Playgroud)

我知道还有很多其他的方法.

但我想知道我什么时候使用CFRelease方法.

我认为group2的所有方法都不做CFRelease

因为它包含单词"Get",未分配.

我认为group1的所有方法都必须使用CFRelease

因为有一个字符串"copy".

我有一本书.

但是有两次使用CFRelease.

一个是发布ABAddressBookCreate()

另一个是ABAddressBookCopyPeopleWithName.

所有其他事情都不使用CFRelease.

所以我想知道我何时使用CFRelease.

当我使用CFRelease时请告诉我.

iphone xcode objective-c ios

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

是否可以将两个视频文件合并为一个文件,iOS 中的一个屏幕?

我是视频编程的新手。我正在尝试练习它,但遇到了问题,将两个视频文件合并为一个。

我的意思是合并如下..

我有第一个这样的视频 输入图像描述它我

第二个视频也喜欢这个 在此处输入图片说明

我希望他们像这样合并 在此处输入图片说明

我不想使用 2 个视频播放器,因为我想将合并的视频文件发送给某人。我搜索了一整天来解决这个问题,但我找不到如何解决。

我编写了引用链接的代码,但它仅显示第一个视频,未合并。

我的代码:

NSURL *firstURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video1" ofType:@"mp4"]]
AVURLAsset  *firstAsset = [[AVURLAsset alloc]initWithURL:firstURL options:nil];

NSURL *secondURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video2" ofType:@"mp4"]];
VURLAsset  *secondAsset = [[AVURLAsset alloc]initWithURL:secondURL options:nil];

AVMutableComposition* mixComposition = [AVMutableComposition composition];
AVMutableCompositionTrack *firstTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo
                                                                  preferredTrackID:kCMPersistentTrackID_Invalid];
[firstTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, firstAsset.duration)
                    ofTrack:[[firstAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]
                     atTime:kCMTimeZero error:nil];

AVMutableCompositionTrack *secondTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo
                                                                   preferredTrackID:kCMPersistentTrackID_Invalid];

[secondTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, secondAsset.duration)
                     ofTrack:[[secondAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]
                      atTime:kCMTimeZero error:nil];

[secondTrack setPreferredTransform:CGAffineTransformMakeScale(0.25f,0.25f)];

NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, …
Run Code Online (Sandbox Code Playgroud)

iphone video objective-c avfoundation ios

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

UITextView.text不起作用

嗨,我正在学习iOS编程.

我很难使用UITextView.

我做了一个项目并打开viewController.xib

我拖入了UISearchBar,UITextView和UILabel

我的viewController遵循UISearchBarDelegate

我想更改textView.text的内容,但它没有.

这是我的代码.

-(void)viewDidLoad
{
   [super viewDidLoad];
   self.mySearchbar.delegate = self;
}

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
    [searchBar resignFirstResponder];
    self.myLabel.text = @"hoho";
    self.myTextview.text = @"hoho";
}
Run Code Online (Sandbox Code Playgroud)

当我点击搜索栏并输入任何字符并返回时,

myLabel的文字设置为hoho.

但myTextview.text没有设置.没有效果.

这是为什么??我很困惑..请帮助我

iphone xcode ios

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

什么是意思 - (IBAction)行为功能?

嗨,我正在学习iOS,但我遇到了麻烦.

这里有四种功能..

-(IBAction) behavior : (UIButton *) sender;

-(IBAction) behavior : (id) sender;

-(IBAction) behavior : sender;

-(IBAction) behavior;
Run Code Online (Sandbox Code Playgroud)

我知道前三件事.但我不知道最后一个功能

-(IBAction) behavior;
Run Code Online (Sandbox Code Playgroud)

是什么意思?当我用这个?

如果我有一个按钮,那么我可以使用此功能

但我不能用它.如果我有一个滑块,或选择器视图..无论如何

它是按钮的唯一用途?

iphone

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

标签 统计

iphone ×4

ios ×3

objective-c ×2

xcode ×2

avfoundation ×1

video ×1