HI,我有一个NSMutableDicitionary包含小写和大写的键.所以目前我不知道如何使用目标c找到字典中的密钥而不管密钥.
我正在尝试在我的iPhone应用程序中使用自定义字体.
我在info.plist中为它创建了一个密钥,如下所示:
<key>UIAppFonts</key>
<array>
<string>CloisterBlack.ttf</string>
</array>
Run Code Online (Sandbox Code Playgroud)
我正在访问这样的字体:
[UIFont fontWithName:@"CloisterBlack" size:64.0]
Run Code Online (Sandbox Code Playgroud)
但字体没有显示.可能是什么原因?
我需要NSRange对象作为给定NSString中每个大写字母的位置,以输入自定义属性字符串类的方法.
当然有很多方法可以实现这一点,例如rangeOfString:options:使用NSRegularExpressionSearch或使用RegexKitLite在遍历字符串时单独获取每个匹配.
完成此任务的最快表现方法是什么?
有没有办法NSRegularExpression指定您想要进行区分大小写的搜索?我试图在下面的文本中匹配大写TAG"ACL".我使用的模式很简单:
// Pattern
[A-Z]+
// SearchText
<td align=\"left\" nowrap><font face=\"courier, monospace\" size=\"-1\">ACL*</font></td>
// Code:
NSString *textBuffer = @"<td align=\"left\" nowrap><font face=\"courier, monospace\" size=\"-1\">ACL*</font></td>";
NSString *pattern = @"([A-Z]+)";
NSRegularExpression *regExp = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:nil];
NSTextCheckingResult *result = [regExp firstMatchInString:textBuffer options:0 range:NSMakeRange(0, [textBuffer length])];
NSLog(@"OBJECT CLASS: %@", [textBuffer substringWithRange:[result range]]);
Run Code Online (Sandbox Code Playgroud)
输出:(使用case-Insensative我按预期获得第一个"td",当我真正想要的是"ACL"时
我知道那NSRegularExpressionCaseInsensitive是错的,我希望会有一个NSRegularExpressionCaseSensitive.还有一个flagOption ?(i),它还指定了一个不区分大小写的搜索,但同样没有任何案例敏感的搜索.我错过了什么?
我正在加载字体并将其设置在这样的标签上
UIFont *font = [UIFont fontWithName:@"MyMonoFont" size:150.0];
label.font = font;
label.text = "TOBY"
Run Code Online (Sandbox Code Playgroud)
但是,它似乎会剪切或隐藏文本的底部(如下所示).它适用于我尝试的另一种字体.两种字体都是TTF,并且根据Mac的Font Book应用程序中的"验证"操作"有效".

有一些限制(它的自动布局),但正如我所说,anther字体似乎应对好.
谢谢你的任何提示.
编辑:有点更新; 更新标签框架大小没有区别(如果我有自动布局).我想保持自动布局,但怀疑它的框架发生冲突/调整大小.我想知道是否有一种方式可以让他们玩得很好.
我试图将我的iOS应用程序上传到App Store.一段时间后,我收到一条消息"提交成功,在验证过程中发现了一些警告",并附有警告列表.

如果有人知道这些警告,请帮助我.
uploading app-store appstore-approval application-loader xcode-organizer
我正在尝试为我的iOS应用程序使用自定义字体.这就是我的工作
我将自定义字体(m.tff)添加到Xcode支持文件目录中.此外,我创建了一个名为Fonts的条目,由myApp.plist中的字体(m.tff)的值名称提供
在我看来,我有一个标签
UILabel *label = [[UILabel alloc]initWithFrame:CGRect(10, 20, 230, 30)];
label.font = [UIFont fontWithName:@"My custom font" size:15];
Run Code Online (Sandbox Code Playgroud)
等等...
问题是,当我启动应用程序时,标签中的文本是使用默认字体而不是使用特定字体.
我想念的是什么?
EDITED
好吧它现在似乎有效,但字体仅适用于像?但不是为了信件.我正在使用西里尔文btw.
在我的应用程序中,我正在做的是:
rootViewController - > pushViewController - > pushViewController - > pushViewController - > presentModalViewController
从presentModalViewController我想直接去rootViewController.
所以我做的是:
while(theViewController = [theObjectEnumerator nextObject ])
{
if([theViewController modalTransitionStyle] == UIModalTransitionStyleCoverVertical)
{
[self.mNavigationController popToRootViewControllerAnimated:
YES];
}
}
}else
while(theViewController = [theObjectEnumerator nextObject ])
{
if([theViewController modalTransitionStyle] == UIModalTransitionStyleCoverVertical)
{
[self.mNavigationController dismissModalViewControllerAnimated:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
但在这里我收到一条消息
警告:在演示或解雇过程中尝试从视图控制器中解除!
并在此应用程序崩溃后.
我搜索了这个,但找不到对我有用的东西,任何机构都可以解释为什么会这样吗?
objective-c uinavigationcontroller presentmodalviewcontroller ios poptoviewcontroller
我正在尝试使用NSURLSessionDownloadTask从S3服务器下载安全文件,但它返回403错误(拒绝访问).
我的代码:
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://xxx.amazonaws.com/bucket-name/file_name"]];
request.HTTPMethod = @"GET";
[request setValue:@"kAccessKey" forHTTPHeaderField:@"accessKey"];
[request setValue:@"kSecretKey" forHTTPHeaderField:@"secretKey"];
NSURLSessionDownloadTask *downloadPicTask = [[NSURLSession sharedSession] downloadTaskWithRequest:request completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) {
UIImage *downloadedImage = [UIImage imageWithData:
[NSData dataWithContentsOfURL:location]];
dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.imageView.image = downloadedImage;
[weakSelf.activityIndicator stopAnimating];
});
}];
[downloadPicTask resume];
Run Code Online (Sandbox Code Playgroud)
编辑
我找到了这段代码:
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc]initWithRegionType:AWSRegionUSWest2 identityId:@"xxxxxxx" identityPoolId:@"xxxxxxxx" logins:nil];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc]initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider];
// Construct the NSURL for the download location.
NSString *downloadingFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"sample_img.png"];
NSURL *downloadingFileURL …Run Code Online (Sandbox Code Playgroud) 将NSString与一组不区分大小写的其他字符串进行比较的最佳方法是什么?如果它是其中一个字符串,则该方法应返回YES,否则返回NO.
ios ×9
objective-c ×7
iphone ×3
custom-font ×2
fonts ×2
nsstring ×2
uifont ×2
amazon-s3 ×1
app-store ×1
cocoa-touch ×1
compare ×1
nsrange ×1
uilabel ×1
uploading ×1