摘要:问题:NSDate SDK4.1取得的时间全部为GMT了,怎么改成本地时间NSDateSDK4.1取得的时间全部为GMT了,怎么改成本地时间其它版本正常,取得的时间为本地时间谢谢~答案:NSTimeZone *zone = [NSTimeZone systemTimeZone];NSInteger interval = [zone secondsFromGMTForDate:date];NSDate *localeDate = [date addTimeInterval:interval];这样就转化为本地时间了,但是以前正常的版本也加了8小时,所以还是有问题。。。。
阅读全文
摘要:- (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay inModes:(NSArray *)modes;- (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay;+ (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSele
阅读全文
摘要:#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,960), [[UIScreen mainScreen] currentMode].size) : NO)
阅读全文
摘要:Uninstalling Xcode Developer ToolsTo uninstall Xcode developer tools on the boot volume along with the <Xcode> directory, from a Terminal window type:$ sudo <Xcode>/Library/uninstall-devtools --mode=allTo remove the underlying developer content on the boot volume, but leave the <Xcode
阅读全文
摘要:一个path有一个或者多个shapes,或者subpaths定义。一个subpath可以包含直线段,曲线或者都有。其可以是开的或者封闭的。subpath可以是一个简单的形状,如line,circle,rectangle,star,或者其他更复杂的形状,下图展示了我们可以创建的形状。直线可以是虚的,也可以是实的。在本篇中,将介绍如何构造path,如何stroke和paint path,以及参数影响path的表现形式。1.path的创建和path的paintingpath的创建和path的painting是独立的任务。首先创建一个path,当想要去显示时,要请求Quartz去paint。如下图,我
阅读全文
摘要:原文地址:https://developer.apple.com/library/prerelease/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iOS5.htmliCloud Storage APIsThe iCloud storage APIs let your application write user documents and data to a central location and access those items from all of a user’s computers and iOS devices
阅读全文
摘要:在active.com的开发项目中,遇到一个动态显示detail page的问题。取的数据有的时候多有的时候少,而且还需要自动换行。计算行的高度,text的长度,大小等。EventAddresslabel=[[UILabelalloc]initWithFrame:CGRectMake(starttimelabel.frame.origin.x, starttimelabel.frame.origin.y+distance,270,20)];EventAddresslabel.backgroundColor=[UIColorclearColor];EventAddresslabel.textCo
阅读全文
摘要:UIButton *button= [[UIButton alloc] initWithFrame:CGRectMake(0,0,70,70)];button.buttonType = UIButtonTypeCustom;UIImage *buttonImage = [UIImage imageNamed:@"image.png"];UIImage *stretchableButtonImage = [buttonImage stretchableImageWithLeftCapWidth:12 topCapHeight:0];[button setBackgroundI
阅读全文
摘要:在使用UISearchBar时,将背景色设定为clearColor,或者将translucent设为YES,都不能使背景透明,经过一番研究,发现了一种超级简单和实用的方法:1[[searchbar.subviews objectAtIndex:0]removeFromSuperview];背景完全消除了,只剩下搜索框本身了。
阅读全文
摘要:本文介绍Objective C中实现观察者模式(也被称为广播者/监听者、发布/注册或者通知)的五种方法以及每种方法的价值所在。该文章将包括:1 手动广播者和监听者(Broadcaster and listeners)2 键-值观察(Key Value Observing)3 通知中心(Notification center)4 上下文通知(Context notification)5 用于观察的委托(Delegate)关于观察者 观察者模式是维持两个模块之间抽象关系的最强大的方式之一。观察者模式包括一个发布已发生事件的模块以及响应该事件的另一模块的若干个的实例。它和直接调用第二个模块的方法不.
阅读全文
摘要:最近写程序需要用到这类,研究了下,现把成果和大家分享。NSNotificationCenter是专门供程序中不同类间的消息通信而设置的,使用起来极为方便,长话短说。设置通知,就是说要在什么地方(哪个类)接受通知,一般在初始化中做。[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(test:)name:@"test"object:nil];我仅对以上参数做以说明:addObserver 这个是观察者,就是说 在什么地方接收通知; selector 这个是收到通知后,调用何种方法; na
阅读全文
摘要:用Quartz 2d勾画图形可能大家都会,但是如何让我们勾画的图形响应事件呢?有人会说用坐标计算啊,但是有时候对不规则的图形,这个办法不使最简单的做法,下面的代码可以帮你很容易实现这一点。//只是代码而已 , 如果有兴趣的同学 我们可以私下探讨 email:zhuolaiqiang@mail.com//原帖地址 http://blog.csdn.net/diyagoanyhacker/article/details/6608840- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch =
阅读全文
摘要:这几天通过iTunes看了斯坦福大学的视频教程,学到了不少东西,给大家推荐一下:斯坦福iPhone编程课程收看次数破百万http://zx.sj.91.com/content/2009-05-18/20090518175143833.shtmlhttp://itunes.stanford.edu/其他iPhone资料:10家不错的iPhone编程资源网站http://news.weiphone.com/news/2008-12-12/10jiabucuodeiPhonebianchengziyuanwangzhan_171541.shtmliphone遊戲編程教材網站推薦今天無意中找到這個叫
阅读全文
摘要:1. 首先要明确的是,不使用pushViewController的默认动画,所以在调用这个函数时,要将animated设置为NO.2. 使用普通的来CATransition实现转换效果,代码如下: CATransition *animation = [CATransition animation]; [animation setDuration:0.3]; [animation setType: kCATransitionMoveIn]; [animation setSubtype: kCATransitionFromTop]; [animation setTimingFunction:[CA
阅读全文
摘要:自定义了一个UITableViewCell,但是在显示在TableView中时,第一个Cell左上角和右上角显示的时候,没有圆角,检查了一下代码,将Cell子类中设置frame的语句屏蔽掉就可以了:- (id)initWithStyle:(UITableViewCellStyle) style reuseIdentifier: (NSString *) reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { //remove this line to keep firs
阅读全文
摘要:图片圆角 image round corner:m_mainImgView.layer.cornerRadius = 6;m_mainImgView.layer.masksToBounds = YES;自动适应,保持图片宽高比 aspect fit:m_mainImgView.contentMode = UIViewContentModeScaleAspectFit;见下图:Ori:round corner:Aspect Fit:
阅读全文
摘要:使UITableView最上面留出UINavigationBar空间的两种方法使UINavigationBar透明,TableView在其下面,可以扩大UITableView的视野.1) UIView *headerView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, 320, 44)]; m_tableView.tableHeaderView = headerView;2) m_tableView.contentInset = UIEdgeInsetsMake(44, 0, 0, 0); m_tableView.scrollIndica
阅读全文
摘要:来自http://blog.csdn.net/omgle/archive/2011/06/29/6574313.aspx第一部分:Push原理(以下绝大多数内容参考自、图片来自iPhone OS Reference Library)机制简介Push的工作机制可以简单的概括为下图图中,Provider是指某个iPhone软件的Push服务器。APNS是Apple Push Notification Service(Apple Push服务器)的缩写,下文统一使用该缩写。因此,整个过程可以分为三个阶段,下面用大家常用的聊天客户端BeejiveIM来说明。(BeejiveIM是一款支持多账户登录的支
阅读全文
摘要:卖家工具来自http://open.taobao.com/dev/index.php/%E5%8D%96%E5%AE%B6%E5%B7%A5%E5%85%B7目录 [隐藏]1 商品管理1.1 商品管理介绍1.2 场景描述1.3 业务规则1.4 调用API1.5 一、搜索产品信息1.6 二、发布产品1.7 三、发布商品2 库存管理2.1 库存管理介绍2.2 场景描述2.3 业务规则2.4 调用API2.5 一、同步商品库存信息3 订单管理3.1 订单管理介绍3.2 场景描述3.3 业务规则3.4 调用API3.5 一、搜索当前会话用户作为卖家已卖出的交易数据3.6 二、取到单笔交易的详细信息3.
阅读全文
摘要:DOM是一种api。简单的说,api就是一组已经得到有关各方共同认可的基本约定。
阅读全文