小编Tas*_*que的帖子

在UIView中使用UIImagePickerController

我有按钮,当我点击显示相机(完美的工作)

- (IBAction)getPhoto:(id)sender
{
    NSLog( @"Button clicked!" );
    imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
    }

    else {  // IF the device doesn't have a camera, so use the photos album
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
    }

    [self addSubview:imagePicker.view];
}
Run Code Online (Sandbox Code Playgroud)

之后我可以拍摄图像,等等 - 但是当我点击"使用"时:这里没有任何反应是我的方法:图像选择器没有解雇它的方法:应用程序根本什么都不做,我正试图拍摄我只是的图像将其显示在屏幕上的CGRect中.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissViewControllerAnimated:YES completion:NULL];

    UIImageView *patientImage = [[UIImageView alloc] init];
    patientImage.frame = CGRectMake(625, 25, 83, 103);

    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    self.patientImage.image = chosenImage;
}
Run Code Online (Sandbox Code Playgroud)

即使我在没有拍摄图像的情况下点击取消按钮,imagePicker(相机界面)也不会自行解除

任何帮助,建议或指导将非常感激.

uiview uiimageview uiimagepickercontroller ipad ios

8
推荐指数
3
解决办法
7680
查看次数

NSDictionary中的NSDictionary

好的,我有一个.plist文件,

我有一个NSDictionary *StoredAddresses,

里面StoredAddresses,是另一把NSDictionary

我知道我可以用,

if ([dictionaryOfAddresses objectForKey:@"StoredAddresses"])
Run Code Online (Sandbox Code Playgroud)

要访问顶级NSDictionaries,但如何在存储的地址内搜索密钥?

xcode key objective-c nsdictionary

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

iOS导航栏VS UIToolBar

根据Apple的" 人机界面指南 " - 导航栏应该只有一个其他按钮(除标准后退按钮外)

这一切都很好,但有几个应用程序在顶部导航栏上有许多按钮,如Facebook应用程序(图像)我的问题/讨论来自这里...

1)苹果会接受使用UIToolBar代替导航栏(带有自定义"后退"按钮",它可以作为导航栏的替代品:

2)这是Facebook如何实现他们的顶级酒吧?

3)如果我可以使用工具栏而不是导航栏,我会在顶部有一个小空间,工具栏将与"状态栏"重叠 - 我应该如何克服这个问题? - - 将A UIView置于具有嵌入式工具栏的位置是否是解决此问题的正确方法?

非常感谢您的所有帮助/意见/指南

uitoolbar uiviewcontroller uiview uinavigationcontroller ios

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

Objective-C:在for循环中向NSArray添加对象

我正在尝试循环一个数组(比较Addr),找到匹配的字符串(currentAddr),并尝试只将matvched字符串放入另一个数组但我不断收到错误

"NSArray没有可见的@Interface声明选择器addObject"

NSArray *matchedAddr;
//NOTE: multiple addresses from compareAddr[i] may match to multiple stored Addresses
for (NSUInteger i = 0; i < [compareAddr count]; i++)
{
    //Checking IF the obtained key (Mac Address) at compareAddr[i] matches one of the stored Addresses
    NSString *currentAddr = [compareAddr objectAtIndex:i];
    BOOL addrExists = ([[dictionaryOfAddresses     objectForKey:@"StoredAddr"]objectForKey:currentAddr] != nil);

    if (addrExists)
    {   
        NSLog (@"Match found at index %1u", i);
        [matchedAddr addObject:currentAddr];
    }

    else { NSLog(@"No Value matches at index %i \n", i); }
}
NSLog (@"Array …
Run Code Online (Sandbox Code Playgroud)

loops objective-c nsarray

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

Evaulate NSString并作为Objective-C代码执行

这可能是一个完全荒谬的问题,但是有可能使用a NSString作为代码行的替代品吗?

for (int i = 0; i < 10: i++){    
    NSString *cam = @"locXCamProfileSwitch";
    ["%@", cam setOn:YES];
]
Run Code Online (Sandbox Code Playgroud)

也有可能将索引i汇入更换X

loops concatenation objective-c nsstring

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

计算objective-c中2个数字之间的差异

我知道之前有一个类似的问题用C# 两个数字之间的差异

但是我需要知道objective-c是否提供了一些函数来找到2个数字之间的差异,(2个NSIntegers,具体)

例如:之间的区别:

100和25是75

-25和100是125

100和-25也是125

-100和-115是15

//我知道我使用的是与之前相同的例子

很感谢任何形式的帮助

iphone macos objective-c ios

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