小编9to*_*ios的帖子

如何使用图像Exif元数据从iPhone相机获取物体距离?


编辑:对不起晚编辑,没有两个参数你无法计算它,所以首先需要从地面填充用户相机高度.


我已经检查了一些解决方案,但没有一个有用!

我知道工作距离=(传感器高度+主体高度)*焦距/传感器高度

distance to object (mm) = focal length (mm) * real height of the object (mm) * image height (pixels)
                          ----------------------------------------------------------------
                                object height (pixels) * sensor height (mm)
Run Code Online (Sandbox Code Playgroud)

我希望与此保持距离:

镜片和眼睛形成图像

您好我使用图像Exif ALAssetsLibrary获取以下信息

我得到了以下元数据:

Save image metadata.
 {
    DPIHeight = 72;
    DPIWidth = 72;
    FaceRegions =     {
        Regions =         {
            HeightAppliedTo = 2448;
            RegionList =             (
                                {
                    AngleInfoRoll = 270;
                    AngleInfoYaw = 0;
                    ConfidenceLevel = 376;
                    FaceID = 1;
                    Height = "0.1413399";
                    Timestamp = 5996166864910;
                    Type …
Run Code Online (Sandbox Code Playgroud)

iphone camera objective-c cocos2d-iphone ios

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

推视图控制器,黑屏

我正在推动一个新的视图控制器并将一些数据传递给它.当我运行应用程序时,我可以按下按钮并推送到新视图,但屏幕完全是黑色.任何帮助表示赞赏.

- (IBAction)button:(id)sender {

    NSString *firstField = self.field.text;
    NSString *secondField = self.field2.text;

    self.resultsArray = [[NSArray alloc] initWithObjects:firstField, secondField, nil];

    NSUInteger randomResult = arc4random_uniform(self.resultsArray.count);
    self.label.text = [self.resultsArray objectAtIndex:randomResult];

    ImagesViewController *ivc = [[ImagesViewController alloc] init];
    ivc.label = self.label.text;
    [self.navigationController pushViewController:ivc animated:YES];

}
Run Code Online (Sandbox Code Playgroud)

uiviewcontroller ios

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

使用autoresize的阿拉伯语英语iPhone用户界面?

您好我想将我的整个UI视图转换为阿拉伯语[从右到左] 如果用户从设置更改语言并打开应用程序.

我有以下查询

1)我是否需要为每个创建单独的UI?2)有没有简短的方法来实现这一目标?3)我需要完整的UI转换像镜像,从左侧[幻灯片菜单]是从右侧等... 4)Xcode 8.2有autoresize再次介绍与自动布局我可以这样做没有自动布局?

iphone xcode autoresize ios autolayout

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

证书固定在Xcode中

在Android下面获得了证书固定代码

CertificatePinner certificatePinner = new CertificatePinner.Builder()
.add("publicobject.com", "sha1/DmxUShsZuNiqPQsX2Oi9uv2sCnw=")
.add("publicobject.com", "sha1/SXxoaOSEzPC6BgGmxAt/EAcsajw=")
.add("publicobject.com", "sha1/blhOM3W9V/bVQhsWAcLYwPU6n24=")
.add("publicobject.com", "sha1/T5x9IXmcrQ7YuQxXnxoCmeeQ84c=")
.build();
Run Code Online (Sandbox Code Playgroud)

如何使用NSURLSession方法在IOS中实现相同的任务?

这里有一些参考代码

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, 0);
NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate));
NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"MyLocalCertificate" ofType:@"cer"];
NSData *localCertData = [NSData dataWithContentsOfFile:cerPath];
if ([remoteCertificateData isEqualToData:localCertData]) {
NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
}
else {
[[challenge sender] cancelAuthenticationChallenge:challenge];
}
Run Code Online (Sandbox Code Playgroud)

编辑部分

我得到了以下解决方案,在NSURLSession中自动调用委托函数,有人可以解释它是如何工作的吗?还需要发送乘数证书我该怎么做?

 (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c ios

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

在NSDictionary中传递NSDate并转换为NSData以进行jsondata修复

我有一个json NSStringNSDate数据(dob)我创建NSDictionary它,但当我使用代码将其转换为数据

 NSData *requestData1 = [NSJSONSerialization dataWithJSONObject:json_inputDic options:0 error:&error];
Run Code Online (Sandbox Code Playgroud)

通过给出错误来杀死它

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__NSDate)'
Run Code Online (Sandbox Code Playgroud)

我的问题是我需要传递dob,因为NSDate是强制性的.我如何解决它?

例如

   NSDate *newDate = [NSDate date];
    [dic setValue:newDate forKey:@"dob"];


    NSString *good = @"good";

    [dic setValue:good forKey:@"good"];

    NSLog(@"dic=%@",dic);
    NSError *error;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&error]; //it gives error

    NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    NSLog(@"jsonData as string:\n%@", jsonString);
Run Code Online (Sandbox Code Playgroud)

json objective-c nsdictionary nsdate ios

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

使用掩蔽从图像裁剪字母

我需要的:

1)从库或相机中选择图像

2)写和文字

3)文字被裁剪成图像!

下面的图片可以更清楚地说明我需要什么.

在此输入图像描述

我知道屏蔽和裁剪图像,即使我在emoji me app中使用框架进行遮罩.我只需要知道如何根据动态文本裁剪图像.

请提出你的建议.

...
UIImage *image = [UIImage imageNamed:@"dogs.png"];
UIImage *mask = [UIImage imageNamed:@"mask.png"];

// result of the masking method
UIImage *maskedImage = [self maskImage:image withMask:mask];

...

- (UIImage*) maskImage:(UIImage *)image withMask:(UIImage *)maskImage {

    CGImageRef maskRef = maskImage.CGImage; 

    CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
        CGImageGetHeight(maskRef),
        CGImageGetBitsPerComponent(maskRef),
        CGImageGetBitsPerPixel(maskRef),
        CGImageGetBytesPerRow(maskRef),
        CGImageGetDataProvider(maskRef), NULL, false);

    CGImageRef maskedImageRef = CGImageCreateWithMask([image CGImage], mask);
    UIImage *maskedImage = [UIImage imageWithCGImage:maskedImageRef];

    CGImageRelease(mask);
    CGImageRelease(maskedImageRef);

    // returns new image with mask applied
    return maskedImage;
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

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

IOS中的自定义字体无显示(.otf类型)

我的下面San Fransico字体不起作用 下载并测试

我已经在.plist中添加了所有otf文件,并使用该名称在代码中使用字体管理器设置字体,如下所示

lbl_1.font = [UIFont fontWithName:@"SFUIDisplay-Bold" size:20];
lbl_2.font = [UIFont fontWithName:@"SFUIDisplay-Medium" size:20];
lbl_3.font = [UIFont fontWithName:@"SFUIText-Light" size:20];
lbl_4.font = [UIFont fontWithName:@"SFUIText-Regular" size:20];
lbl_5.font = [UIFont fontWithName:@"SFUIText-Semibold" size:20];
Run Code Online (Sandbox Code Playgroud)

注意:我使用Zil回答下载.ttf及其工作

iphone xcode fonts objective-c ios

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

PresentModalViewController 与 PushViewController 内存消耗

我有两种方法可以从一个视图控制器跳转到另一个视图控制器

对于presentViewController

  [self presentModalViewController:view animated:YES];
Run Code Online (Sandbox Code Playgroud)

对于pushViewControlle应该使用

[self.navigationController pushViewController:view animated:YES];
Run Code Online (Sandbox Code Playgroud)

哪种方法是最好的方法?

哪个会导致更多的内存泄漏?

如果我们的设计是这样的,则使用哪一个

Introduction view (bunch of slides )-> login -> signUp-> HomeActivityScreen-> Then Bunch of tab bar in it
Run Code Online (Sandbox Code Playgroud)

xcode objective-c uinavigationcontroller presentmodalviewcontroller ios

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

如果日期改变则执行操作

如果日期改变,我需要执行一些操作.在应用程序启动时的意思是检查今天的日期,如果今天的日期是从最后24小时的时间改变,那么它将执行一些操作.是否可能因为我们不需要运行后台线程.我只想在委托方法中添加某种条件.

喜欢:如果在应用程序启动它首先保存今天日期并保存该日期.再次登录后,它会将该日期与当前日期进行比较,如果将其更改为24小时更改日期,则会执行某些操作.我怎么做的?xc

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

xcode objective-c datetime-format ios

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