随笔分类 -  iphone开发

摘要:label=[[UILabel alloc]initWithFrame:CGRectZero];[label setText:text];[label setLineBreakMode:UILineBreakModeWordWrap];[label setMinimumFontSize:FONT_SIZE];//设置根据label大小换行[label setNumberOfLines:0];[label setFont:[UIFont systemFontOfSize:FONT_SIZE]];[label setTag:1];//边框[[label layer]setBorderWidth:2 阅读全文
posted @ 2013-04-19 12:58 松花江以南 阅读(828) 评论(0) 推荐(0) 编辑
摘要:转载:http://blog.csdn.net/piziliweiguang/article/details/8157171//初始化textfield并设置位置及大小 UITextField *text = [[UITextField alloc]initWithFrame:CGRectMake(20, 20, 130, 30)];//设置边框样式,只有设置了才会显示边框样式 text.borderStyle = UITextBorderStyleRoundedRect;typedef enum { UITextBorderStyleNone, UITextBorderStyleLine.. 阅读全文
posted @ 2013-02-15 21:20 松花江以南 阅读(253) 评论(0) 推荐(0) 编辑
摘要:一周了,总算是把曲线图和柱状图整出来了。记笔记,防忘记。CorePlot SDK的安装:参照http://zani.iteye.com/blog/1135883试用第一种方法安装,我下载的是CorePlot_1.0.zip。只要照着第一种方法做没问题。一 第一种安装方法:1.从http://code.google.com/p/core-plot/downloads/list下载CorePlotInstaller_xxx.zip, 下载后解压并安装, 会将SDK默认安装在/Library/SDKs/CorePlotSDK/目录下.2. 安装后, 在/Library/SDKs/CorePlotSD 阅读全文
posted @ 2012-03-18 23:14 松花江以南 阅读(1641) 评论(0) 推荐(0) 编辑
摘要:iPad iPhone程序增加启动画面为iPad和iPhone程序增加启动画面非常简单,基本思路就是增加启动图片资源Default.png即可,只是要根据不同的分辨率和旋转方向需要有不同的图片尺寸。目前的iOS设备有三种不同的分辨率:1iPad 768x10242iPhone4 640x9603iPhone 320x480如果一个程序,既要支持iPad又要支持iPhone,那么它需要包含下面几个图片:1Default-Portrait.png iPad专用竖向启动画面 768x1024或者768x10042Default-Landscape.png iPad专用横向启动画面 1024x768或 阅读全文
posted @ 2012-02-09 12:57 松花江以南 阅读(969) 评论(0) 推荐(0) 编辑
摘要:iphone开发资源汇总如何用Facebook graphic api上传视频:http://developers.facebook.com/blog/post/532/Keychain保存数据封装:https://github.com/carlbrown/PDKeychainBindingsController对焦功能的实现:http://www.clingmarks.com/?p=612自定义圆角Switch按件:https://github.com/domesticcatsoftware/DCRoundSwitch弹出窗口For iphone and ipad:https://githu 阅读全文
posted @ 2012-02-09 12:39 松花江以南 阅读(1877) 评论(0) 推荐(1) 编辑
摘要:The NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as a index set.You use index sets in your code to store indexes into some other data structure. For example, given an NSArray object, 阅读全文
posted @ 2012-02-01 11:37 松花江以南 阅读(6274) 评论(1) 推荐(2) 编辑
摘要:1,获取翻转事件,并开启翻转:只要在viewcontroller的类中加入-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{//翻转后要执行的代码return YES;}2,-(void)viewWillAppear:(BOOL)animated,- (void)viewDidLoad 的区别。viewwillappear是每次视图控制器的视图出现前执行的代码。而viewdidload是每次视图控制器载入是执行的代码。比如说:当a视图控制器的视图第一次出现是两 阅读全文
posted @ 2012-01-09 17:27 松花江以南 阅读(7998) 评论(0) 推荐(4) 编辑
摘要:偶尔在某些情况下,例如当用户按下应用程序致谢页上的捐款或主页按钮的时候,可能需要调用Safari来为你的应用程序展示这个网页。UIApplication类支持一个openURL方法,可以无缝地启动Safari,并在一个新窗口中载入一个网页。要使用这个方法,你的应用程序需要创建一个NSURL对象。本章稍早前为你介绍了NSURL。NSURL对象被传递给应用程序的openURL方法,应用程序框架会处理这个URL并启动相应的处理程序:添加一个button,给button设定触发方法:-(void)didClicked{ NSURL *url = [[NSURLalloc] initWithStri.. 阅读全文
posted @ 2011-12-25 11:30 松花江以南 阅读(1145) 评论(0) 推荐(0) 编辑
摘要:国家气象局提供的天气预报接口接口地址:http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data/cityinfo/101010100.htmlhttp://m.weather.com.cn/data/101010100.html以json格式提供,格式如下 {"weatherinfo":{//基本信息;"city":"北京","city_en":"beijing","date_y&qu 阅读全文
posted @ 2011-12-24 01:37 松花江以南 阅读(9762) 评论(2) 推荐(1) 编辑
摘要:- (void)loadView { UITextView *back = [[UITextView alloc]initWithFrame:[[UIScreen mainScreen]bounds]]; back.textColor = [UIColor redColor]; back.backgroundColor = [UIColor whiteColor]; self.view = back; }// Implement viewDidLoad to do additional setup after loading the view, typic... 阅读全文
posted @ 2011-11-14 20:07 松花江以南 阅读(571) 评论(0) 推荐(0) 编辑
摘要:IOS开发之手势——UIGestureRecognizer 共存在 iPhone 或 iPad 的开发中,除了用touchesBegan / touchesMoved / touchesEnded这组方法来控制使用者的手指触控外,也可以用UIGestureRecognizer的衍生类別来进行判断。用UIGestureRecognizer的好处在于有现成的手势,开发者不用自己计算手指移动轨迹。UIGestureRecognizer的衍生类別有以下几种:UITapGestureRecognizerUIPinchGestureRecognizerUIRotationGestureRecognizer 阅读全文
posted @ 2011-10-27 14:44 松花江以南 阅读(86594) 评论(2) 推荐(5) 编辑
摘要:UIImage应用与内存管理用UIImage加载图像的方法很多,最常用的是下面两种: 一、用imageNamed函数引用 [UIImage imageNamed:ImageName]; 二、用NSData的方式加载,例如:引用NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:extension]; NSData *image = [NSData dataWithContentsOfFile:filePath]; [UIImage imageWithData:image]; 三,使用[UII.. 阅读全文
posted @ 2011-10-27 11:07 松花江以南 阅读(5569) 评论(1) 推荐(0) 编辑
摘要:iphone之在视图上显示当前的时间,并且时间还在走。在RootViewController.h中:#import <UIKit/UIKit.h>@interface RootViewController : UIViewController {NSTimer *_timer;UILabel *timeLabel;}@property (nonatomic,retain) UILabel *timeLabel;@end在RootViewController.m中:#import "RootViewController.h"#import <stdarg.h 阅读全文
posted @ 2011-10-26 13:19 松花江以南 阅读(3296) 评论(0) 推荐(1) 编辑
摘要:iPhone,iPhone4,iPad程序启动画面的总结iOS设备现在有三种不同的分辨率:iPhone320x480, iPhone 4 640x960, iPad 768x1024。以前程序的启动画面(图片)只要准备一个Default.png就可以了,但是现在变得复杂多了。如果一个程序,既支持iPhone又支持iPad,那么它需要包含下面几个图片:Default-Portrait.png iPad专用竖向启动画面 768x1024或者768x1004Default-Landscape.png iPad专用横向启动画面 1024x768或者1024x748Default-PortraitUps 阅读全文
posted @ 2011-10-25 11:21 松花江以南 阅读(398) 评论(0) 推荐(0) 编辑
摘要:两个非常好看的背景,前者在viewDidLoad中直接添加一行代码:self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; // use the table view background color后者效果添加下面的一行:self.view.backgroundColor = [UIColor scrollViewTexturedBackgroundColor]; // use the table view background color唉,以前怎么没有知道这么回事呢。 阅读全文
posted @ 2011-10-20 12:03 松花江以南 阅读(2518) 评论(0) 推荐(0) 编辑
摘要:UITableViewCell 重用问题,摘自别人。感谢做者分享。http://www.cnblogs.com/cherri/archive/2010/08/26/1808859.htmlsqlite + UITableView 实现iPhone大数据浏览iPhone程序和传统的桌面程序的最大不同在于内存有限, 管理内存成了iPhone开发中时时刻刻需要谨记的事情。类似的功能在桌面程序上无非是将down下来的数据缓存于内存中,需要的时候画出来即可。 此法在iPhone上切不可行,虽然UITableViewCell可与reuse重复使用以节约内存使用量, 但是数据还是需要host在array或者 阅读全文
posted @ 2011-10-19 09:04 松花江以南 阅读(1405) 评论(0) 推荐(0) 编辑
摘要:官方网站的例子,摘自别人的博客。谢谢原博客的分享。http://blog.csdn.net/cocoa_geforce/article/details/6717377http://developer.apple.com/iphone/library/samplecode/Reachability/Reachability.ziphttp://developer.apple.com/iphone/library/samplecode/avTouch/avTouch.ziphttp://developer.apple.com/iphone/library/samplecode/AdvancedUR 阅读全文
posted @ 2011-10-17 11:50 松花江以南 阅读(3113) 评论(0) 推荐(0) 编辑
摘要:有两个视图,横屏视图和纵屏视图,当iphone的方位变化的时候,这两个视图相互切换。1。两个视图:PortraitView和LandscapeView ,分别标示纵屏和横屏。2。一个控制器,RootViewController,根控制器。3。在RootViewController.m中有以下代码-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ if (UIInterfaceOri... 阅读全文
posted @ 2011-10-14 10:01 松花江以南 阅读(12987) 评论(0) 推荐(0) 编辑
摘要:iphone 恒屏和自动旋转 [声明:摘自他人,感谢作者]IPhone的自动旋转功能一共有3中方法:1.使用自动调整属性处理旋转。利用系统自动生成的代码。- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait);//系统默认不支持旋转功能}要想让系统自动实现旋 阅读全文
posted @ 2011-10-13 16:05 松花江以南 阅读(14354) 评论(1) 推荐(0) 编辑
摘要:美化按钮//添加一个button,美化按钮 UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom]; btn1.frame = CGRectMake(40, 300, 100, 30); UIImage *buttonImageNormal = [UIImage imageNamed:@"whiteButton.png"]; UIImage *stretchableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidt.. 阅读全文
posted @ 2011-10-13 10:27 松花江以南 阅读(1791) 评论(0) 推荐(0) 编辑