![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
iPhone开发点滴
zhouhuishine
专注移动平台的开发
展开
-
程序中跳转到苹果商店
<br />跳转到iPhone上苹果商店的链接<br />http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=xxxxxxxxx&mt=8<br /> <br />跳转到MAC或PC上苹果商店的链接<br />http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=xxxxxxxxx&mt=8<br /> <br />如何获取产品ID<br /><br原创 2010-07-06 11:31:00 · 1908 阅读 · 0 评论 -
CLLocationManager定位失败后不提示?
<br /><br />CLLocationManager类在定位失败后,需要重新调用stopUpdatingLocation方法,才会重新得到定位失败的通知。<br />原创 2010-11-26 17:24:00 · 1271 阅读 · 0 评论 -
IPHONE - Syntax error before '^' token
<br />将旧项目的2.0的SDK升级到SDK4.1时遇到这样的错误 “Syntax error before '^' token” ,定位在UIView.h中。<br /> <br />解决方案:在项目设置中,将"C/C++ Compiler Version" 改为GCC 4.2试试。原创 2010-10-25 17:13:00 · 1020 阅读 · 0 评论 -
提示框(UIAlertView)的偏移问题
UIAlertView中加入输入框,当输入时弹出键盘,此时,提示框会被偏移到屏幕的上方(OS解决方法为:在UIAlertView的show函数前,加入反偏移的代码,代码如下:UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请输入手机号码" message:@" " delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"发送", nil]; [phoneNoText setF原创 2010-10-22 17:17:00 · 2057 阅读 · 0 评论 -
Objective-C中列表倒序
<br /><br />@interface NSArray (Reverse)<br /> <br />- (NSArray *)reversedArray;<br /> <br />@end<br /> <br /> <br />@interface NSMutableArray (Reverse)<br /> <br />- (void)reverse;<br /> <br />@end<br /> <br /> <br /><br />@implementation NSArray (Reverse原创 2010-10-22 17:23:00 · 1563 阅读 · 0 评论 -
Objective-C中验证Email
<br /><br /><br />@interface NSString (ValidEmailAddition) <br /> <br />- (BOOL)isValidEmail;<br /> <br />@end<br /> <br /> <br />@implementation NSString (ValidEmailAddition) <br /> <br />- (BOOL)isValidEmail <br />{ <br /> NSString *emailRegEx =原创 2010-10-22 17:21:00 · 1613 阅读 · 0 评论 -
iPhone中压缩图片
<br /><br />@interface UIImage (Compress)<br /> <br />- (UIImage *)compressedImage;<br />- (CGFloat)compressionQuality;<br />- (NSData *)compressedData;<br />- (NSData *)compressedData:(CGFloat)compressionQuality;<br /> <br />@end<br /> <br /> <br /><br />原创 2010-10-22 17:25:00 · 4190 阅读 · 0 评论 -
Objective-C中的_cmd是什么意思?
<br />Objective-C的编译器在编译后会在每个方法中加两个隐藏的参数:<br />一个是_cmd,当前方法的一个SEL指针。<br />另一个就是用的比较多的self,指向当前对象的一个指针。原创 2010-12-11 19:28:00 · 5766 阅读 · 0 评论 -
如何调试EXC_BAD_ACCESS
<br />原文地址:http://www.codza.com/how-to-debug-exc_bad_access-on-iphone <br /><br />当程序出现“EXC_BAD_ACCESS”时,就像不解风情的妻子对你说:“亲爱的,今晚不行”。这两种情况都是非常不幸的。 <br /><br />让我们先看看EXC_BAD_ACCESS到底是什么。 <br /><br />向已经释放的对象发送消息时会出现EXC_BAD_ACCESS。当出现错误时,通常会调用堆栈信息,特别是在多线程的情况下。 <转载 2010-10-20 15:27:00 · 439 阅读 · 0 评论 -
设置Global Breakpoint定位错误代码所在位置
<br />调式程序的时候经常为了出了错误而不知道原因在哪头疼,可以通过设置XCode的Global Breakpoint快速定位错误代码的位置 <br />步骤一: <br />Run–>Show–>Breakpoints,进入断点窗口 <br /><br /> <br /><br /><br />步骤二: <br />为-[NSException raise]设置断点 <br />选择Global Breakpoints, 双击Double-click for Symbol, 输入-[NSExcepti转载 2010-10-20 15:26:00 · 1563 阅读 · 0 评论 -
HTTP Post form 经验记录
<br />post form的格式一定不能变,特别是form中关于data部分的格式。昨晚的BUG就是由于在form中data部分多增加了Content-Length,画蛇添足,导致服务器接收到的data数据体中有多出来的字符(多出来的字符就是Content-Length)。Content-Length应该放在Http头中赋值。特此记录。<br /> <br /><br /><br />另外,post form不可压缩,否则服务器无法识别。<br /><br /><br />最后,附上form的正确格式:原创 2010-10-13 11:04:00 · 6294 阅读 · 0 评论 -
compile error for iphone simulator
<br />http://stackoverflow.com/questions/1626579/compile-error-for-iphone-simulator<br /> <br />I encountered this problem when changing a project from sdk 3.2 to 4.1. Turns out the solution was changing the iOS Deployment Target in the build settings of m转载 2010-10-12 16:44:00 · 509 阅读 · 0 评论 -
CLLocationManager无法获得定位失败的提示?
<br />p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo}span.s1 {text-decoration: underline ; color: #733aa7}span.s2 {text-decoration: underline}span.s3 {font: 13.0px Courier; text-decoration: underline ; color: #666666}<br />CLLocati原创 2010-11-26 17:03:00 · 1217 阅读 · 0 评论 -
Change Company Name from Within Xcode on a Per Project Basis
<br />Change Company Name from Within Xcode on a Per Project BasisPosted on March 25, 2010 by John Muchow in Xcode<br /><br />A common question for most anyone new to Xcode is how to change the Company Name that is added to each new source file. The defaul转载 2010-09-21 10:31:00 · 907 阅读 · 0 评论 -
UITableView设置背景透明
<br />UITableView如果在XIB中设置背景透明,将会看到列表的边框会有黑边。<br />只能通过代码设置背景透明。原创 2010-09-13 17:59:00 · 1765 阅读 · 0 评论 -
如何去除UITableViewStyleGrouped类型的UITableView的边框线
<br />UITableViewStylePlain类型的UITableView去除边框线有直接的属性方法:<br />separatorStyle = UITableViewCellSeparatorStyleNone;<br />但在UITableViewStyleGrouped类型的UITableView中,该方法无效!<br /> <br />如何去除边框线呢?答案很简单:<br />separatorColor=[UIColor clearColor];原创 2010-07-06 11:37:00 · 7164 阅读 · 0 评论 -
神奇的layoutSubviews
最近花了很长时间来调试界面布局问题。自己写的一个View,怎么都无法让它正确的摆放。到最后发现是layoutSubviews引起的。SDK帮助文档中写道:p.p1 {margin: 0.0px 0.0px 10.0px 0.0px; font: 13.0px 'Lucida Grande'}You should override this method only if the autoresizing behaviors of the subviews do not offer the be原创 2011-02-16 15:59:00 · 4027 阅读 · 1 评论