给ios(xcode)添加自定义字体0+

12,509 views / 2012.03.26 / 11:11 下午

相信大家很容易就能从网上找到很多这方面的文档,但真正实施起来,结果会怎样?
有的人成功了
有的人失败了

哈哈,我废话真多。如果你失败了,不妨继续看下去。

我们先温习下别人写的东西:
Add your custom font files into your project using XCode as a resource
Add a key to your info.plist file called UIAppFonts.
Make this key an array
For each font you have, enter the full name of your font file (including the extension) as items to the UIAppFonts array
Save info.plist
Now in your application you can simply call [UIFont fontWithName:@”CustomFontName” size:12] to get the custom font to use with your UILabels and UITextViews, etc…

OK,从这里开始,就是杜工的内容了:
在程序的必经之地写个日志监控下:
NSLog(@”Fonts:%@”, [UIFont familyNames]);
看看有你添加的新字体吗?
如果有,那么恭喜你,你成功了!可以直接调用了。如果没有,请按照如下步骤来:
点击TARGETS中,找到Build phases, 在copy Bundle Resources中查看有没有你刚添加的字体文件,如果没有,点下面的加号添加上,重新编译即可。

Categories: 感悟 Tags: ,

objective-c 遍历表格的方法0+

4,024 views / 2011.08.25 / 9:09 下午
for (int i = 0; i < [ptableView numberOfSections]; i++) {
    for (int j = 0; j < [ptableView numberOfRowsInSection:i]; j++) {
        NSUInteger ints[2] = {i,j};
        NSIndexPath *indexPath = [NSIndexPath indexPathWithIndexes:ints length:2];
            UITableViewCell *cell = [ptableView cellForRowAtIndexPath:indexPath];
           //Here is your code
 
    }
}

希望对你有帮助。

Categories: 感悟 Tags: ,

最近开发的乐助理360应用, 初次使用需要手机接受一条包含激活码的短信,  用户输入正确激活码后才能使用改应用. 所有的事情都做好了,杜工非常期待的提交给了苹果审核,结果人家给rejected了,原因是”我们收不到你们国家的短信,没法测试”,原文如下:

We began the review of your app but are not able to continue because we need demo phone number and verification code to fully access your app features. Please ensure that the demo account you provide includes any data necessary to demonstrate the functionality of your app features.

我了个去, 杜工怎么之前就没想到这点呢?于是一顿穷改, 加了一个固定的测试号码,只要输入这个号码,系统返回的激活码都是固定的就行了. 最后,重新提交审核,在review notes中客客气气的作下说明:

I’m sorry that our sms platform couldn’t send message to your country. So I added a special account as you mentioned in resolution center: 手机号码:130******* 激活码1234 So as long as you entered this phone No. exactly, the active code will always be 1234.
For that and some bug-fixed, I upload a new binary. Thank’s for your kindly help and best regards.

Categories: 感悟 Tags:

问:ios开发下使用什么命令能退出iphone应用?0+

8,001 views / 2011.05.29 / 11:11 下午

There is no API provided for gracefully terminating an iPhone application. Under the iPhone OS, the user presses the Home button to close applications. Should your application have conditions in which it cannot provide its intended function, the recommended approach is to display an alert for the user that indicates the nature of the problem and possible actions the user could take – turning on WiFi, enabling Location Services, etc. Allow the user to terminate the application at their own discretion.

WARNING: It is possible to quit the application by calling exit. Applications calling exit will appear to the user to have crashed, rather than performing a graceful termination and animating back to the Home screen. Such usage provides a negative experience and is strongly discouraged.

Categories: 分享 Tags: