小编Ste*_*ear的帖子

如何从UIImagePickerControllerReferenceURL获取数据?

我在我的应用程序中使用ELCImagePickerController,我不想将选定的fullScreenImage保存到我的数组,因为如果我选择40个iPad图像,那就不好了.

我想从而UIImagePickerControllerReferenceURL不是UIImagePickerControllerOriginalImage从方法的词典中获取数据- (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info.

我试过了:

NSDictionary *dict = [info objectAtIndex:count];            

NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",[dict objectForKey:@"UIImagePickerControllerReferenceURL"]]]];//UIImagePNGRepresentation([UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@",[dict objectForKey:@"UIImagePickerControllerReferenceURL"]]] );
        NSLog(@"length %d",[data length]);
        imageview.image = [UIImage imageWithData:data];
Run Code Online (Sandbox Code Playgroud)

但是,每次我得到0字节.我尝试过在论坛中提供的所有答案,但没有用.

有谁能回答这个问题吗?

objective-c uiimagepickercontroller

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

如何在没有内存泄漏的情况下将图像的NSData转换为CGImageRef

我将图像的NSData转换为CGImage,如下所示,但我在那里得到了内存泄漏但是任何一个告诉我如何转换它而不会泄漏:

CFDataRef imgData;
CGDataProviderRef imgDataProvider;
CGImageRef image1;
imgData = (CFDataRef)[array objectAtIndex:i];
    imgDataProvider = CGDataProviderCreateWithCFData (imgData);
    image1 = CGImageCreateWithPNGDataProvider(imgDataProvider, NULL, true, kCGRenderingIntentDefault);
Run Code Online (Sandbox Code Playgroud)

memory-leaks objective-c cgimageref

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

iOS5上的UIImagePickerController内存泄漏

我正在我的应用程序中使用UIImagePickerController在iOS5和XCode4.2上进行开发,导致内存泄漏,我不知道为什么我得到这个泄漏你能否请给我答案.

在这里我附加我的屏幕截图:

和我的代码:

-(void)createImagePicker 
{
_picker = [[UIImagePickerController alloc] init];
_picker.sourceType = UIImagePickerControllerSourceTypeCamera;

_picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;

_picker.allowsEditing = YES;
_picker.showsCameraControls = NO;


_picker.cameraDevice = UIImagePickerControllerCameraDeviceRear; 

_picker.delegate = self;
_picker.wantsFullScreenLayout = YES;

}
Run Code Online (Sandbox Code Playgroud)

和viewWillApper方法:

    -(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeCameraButton:) name:@"ShowMainView" object:nil];
    [self createImagePicker];
    [m_cameraOverlayView setBackgroundColor:[UIColor clearColor]];
    [self presentModalViewController:_picker animated:NO];
    _picker.cameraOverlayView = m_cameraOverlayView;

    [cameraImgView setHidden:YES];
    [filterView setHidden:YES];
    m_cameraOverlayView.hidden = NO;
    cameraSelectedButton.hidden = NO;
    cancelButton.hidden = YES;
    selectButton.hidden = YES;

    for (id Object in [scrollview subviews])
    {
        if([Object isKindOfClass:[UIButton class]])
        { …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c uiimagepickercontroller ios5

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

我们如何在uitableviewcell中放置一个复选框

我创建了待办事项列表.现在我想为每个单元格设置复选框.当我将其标记为选中时,它可以被标记,然后我们选择删除按钮,如果我们想要,它也在右侧的同一单元格中并删除,但我无法执行这样的操作.

谁能帮帮我吗?

iphone xcode objective-c uitableview

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

NSMutableDictionary的JSONRepresentation

我想JSONRepresentation在一个NSMutableDictionary对象上调用该方法.我正在使用它[userDict JSONRepresentation];,但我收到以下警告:

NSMutableDictionary may not responsd to '-JSONRepresentation'
Run Code Online (Sandbox Code Playgroud)

谁能告诉我如何JSONRepresentationNSMutableDictionary类型的对象上正确调用该方法?

提前致谢.

iphone json nsmutabledictionary

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

无法从ipad设备中的照片库中检索照片

我正在使用ELCImagePickerController从照片库中检索照片.这在ipad模拟器中工作正常,可以显示照片库中的照片.但它不适用于iPad设备.

这表明失败错误意味着没有照片,即使设备有照片.

我使用了以下内容

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];        
[library enumerateGroupsWithTypes:ALAssetsGroupAll
                       usingBlock:assetGroupEnumerator 
                     failureBlock:assetGroupEnumberatorFailure];
Run Code Online (Sandbox Code Playgroud)

适用于模拟器,但不适用于ipad设备.

任何人都可以回复,那里有什么问题.

提前致谢.

xcode objective-c photolibrary ipad

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

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

如何在ipad sdk中检测24小时时间格式

我试图检测时间格式是12小时/ 24小时格式.基于此我在日历中设定时间.
我使用以下代码在viewDidLoad方法中检测设备上的24小时格式.

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[NSLocale currentLocale]];
[formatter setDateStyle:NSDateFormatterNoStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
NSString *dateString = [formatter stringFromDate:[NSDate date]];
NSRange amRange = [dateString rangeOfString:[formatter AMSymbol]];
NSRange pmRange = [dateString rangeOfString:[formatter PMSymbol]];
is24h = (amRange.location == NSNotFound && pmRange.location == NSNotFound);
Run Code Online (Sandbox Code Playgroud)

之后,我检查如下

if (is24h == TRUE) {
} else {
}
Run Code Online (Sandbox Code Playgroud)

但我总是得到is24h值是假的.如果设备设置为12小时格式,我可以在日历中设置时间.但如果是24小时格式,我无法设定时间.

你能告诉我我需要改变的地方吗?

iphone xcode objective-c nsdate nsdateformatter

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

没有在PhotoLibrary iPad中获得结果电影

我正在创建一个带有一系列图像和一个音频文件的电影,并将创建的电影保存到照片库,在模拟器中我正在使用我的图像和音频文件阵列获得正确的电影但是在设备中运行时我没有得到我的结果电影相反,我得到了我添加的视频(我在我的代码中使用的OutPut.mov)来编写我的输出文件(混合音频和图像文件数组).

这是我的代码将我的混合音频和图像数组文件保存到照片库:

AVMutableComposition* mixComposition = [AVMutableComposition composition];
NSString* audio_inputFilePath = [[NSBundle mainBundle] pathForResource:@"Ruler" ofType:@"caf"];
NSURL*    audio_inputFileUrl = [NSURL fileURLWithPath:audio_inputFilePath];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;


NSString *video_inputFilePath = [documentsDirectory stringByAppendingPathComponent:@"videoOutput1234videoOutput1234.mp4"];
NSLog(@"output url %@",video_inputFilePath);


NSURL*    video_inputFileUrl = [NSURL fileURLWithPath:video_inputFilePath];


NSString* outputFilePath = [[NSBundle mainBundle] pathForResource:@"OutPut" ofType:@"mov"];
NSURL*    outputFileUrl = [NSURL fileURLWithPath:outputFilePath];

if ([[NSFileManager defaultManager] fileExistsAtPath:outputFilePath]) 
    [[NSFileManager defaultManager] removeItemAtPath:outputFilePath error:nil];


if ([[NSFileManager defaultManager] fileExistsAtPath:outputFilePath]) 
    [[NSFileManager defaultManager] removeItemAtPath:outputFilePath error:nil];

CMTime nextClipStartTime …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c avassetwriter avmutablecomposition

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