2013年8月27日

ios UIImage图片拉伸 resizableImageWithCapInsets:

摘要: 常见的按钮添加和背景设置如下:UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(80, 130, 160, 44)];[button setTitle:@”Test Button” forState:UIControlStateNormal];// Image with without cap insetsUIImage *buttonImage = [UIImage imageNamed:@”blueButton”];[button addTarget:self action:@selector(buttonPress 阅读全文

posted @ 2013-08-27 16:42 Hai_阔天空 阅读(2136) 评论(0) 推荐(0)

ios 图片拉伸不变形的方法

摘要: 如果一个椭圆图片,原图大小为30*30,而我们让它显示100*30,那么这个图片就会被拉伸,而且效果很难看。用下边的方法可以创建一个局部不被拉伸的图片。UIImage * buttonBg = [[UIImage imageNamed:@"btn_normal.png"]stretchableImageWithLeftCapWidth:10topCapHeight:0];方法说明:- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topC 阅读全文

posted @ 2013-08-27 16:21 Hai_阔天空 阅读(1034) 评论(0) 推荐(0)

ios 的ASIHTTPRequest学习

摘要: 发起一个同步请求同步意为着线程阻塞,在主线程中使用此方法会使应用Hang住而不响应任何用户事件。所以,在应用程序设计时,大多被用在专门的子线程增加用户体验,或用异步请求代替(下面会讲到)。- (IBAction)grabURL:(id)sender{ NSURL *url = [NSURL URLWithString:@" http://allseeing-i.com"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request startSynchronous]; NSError *e 阅读全文

posted @ 2013-08-27 16:00 Hai_阔天空 阅读(231) 评论(0) 推荐(0)

ios 使用ASIHTTPRequest来检查版本更新

摘要: 1 - (void) alertWithTitle: (NSString *)_title_ msg:(NSString *)msg delegate:(id)_delegate cancelButtonTitle:(NSString*)_cancelTitle otherButtonTitles:(NSString*)_otherTitles{ 2 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:_title_ 3 ... 阅读全文

posted @ 2013-08-27 15:50 Hai_阔天空 阅读(346) 评论(0) 推荐(0)

ios ASIHTTPRequest类库简介和使用说明

摘要: 官方网站: http://allseeing-i.com/ASIHTTPRequest/ 。可以从上面下载到最新源码,以及获取到相关的资料。使用iOS SDK中的HTTP网络请求API,相当的复杂,调用很繁琐,ASIHTTPRequest就是一个对CFNetwork API进行了封装,并且使用起来非常简单的一套API,用Objective-C编写,可以很好的应用在Mac OS X系统和iOS平台的应用程序中。ASIHTTPRequest适用于基本的HTTP请求,和基于REST的服务之间的交互。ASIHTTPRequest功能很强大,主要特色如下:l 通过简单的接口,即可完成向服务端提交数据和从 阅读全文

posted @ 2013-08-27 15:09 Hai_阔天空 阅读(256) 评论(0) 推荐(0)

ios 去除UITextField中的空格

摘要: NSString *qName =[userNameText.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 阅读全文

posted @ 2013-08-27 14:47 Hai_阔天空 阅读(799) 评论(0) 推荐(0)

ios UITableView默认选中第一行

摘要: NSIndexPath *ip = [NSIndexPath indexPathForRow:0inSection:0];[titleTableViewselectRowAtIndexPath:ip animated:YESscrollPosition:UITableViewScrollPositionTop]; 阅读全文

posted @ 2013-08-27 13:37 Hai_阔天空 阅读(548) 评论(0) 推荐(0)

ios 监听设备旋转方向

摘要: -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ if(fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { } if (self.interfaceOrientation == UIDeviceOrientation... 阅读全文

posted @ 2013-08-27 13:34 Hai_阔天空 阅读(1076) 评论(0) 推荐(0)

ios 添加朦层

摘要: @interface RootViewController : UIViewController{ UIView *view;}-(void)createBackgroundView{ view = [[UIView alloc]initWithFrame:self.view.frame]; view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0]; view.opaque = NO;UIWindow *appWindow = [[UIApplicationsha... 阅读全文

posted @ 2013-08-27 13:01 Hai_阔天空 阅读(346) 评论(0) 推荐(0)

ios 异步加载图片

摘要: #import "AsyncImageView.h"@implementation AsyncImageView - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { // Initialization code } return self;} - (void)loadImageFromURL:(NSURL*)url { if (connection!=nil) { [connection release]; } if (data!... 阅读全文

posted @ 2013-08-27 11:49 Hai_阔天空 阅读(238) 评论(0) 推荐(0)

ios 屏幕旋转的问题

摘要: 在ios6之前我们旋转屏幕只需要实现shouldAutorotateToInterfaceOrientation就行了- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return YES;}但是ios6上这个就失效了,需要实现shouldAutorotate 和 supportedInterfaceOrientations具体步骤是1. Delegate里面要分开判断ios版本,setRootViewController方法是不同的:1 if ( [[... 阅读全文

posted @ 2013-08-27 10:53 Hai_阔天空 阅读(290) 评论(0) 推荐(0)

导航