2012 年文章归档
共 95 篇文章
ios:升级到Xcode4.5.1的警告处理
Xcode升级到4.5后,出现了一堆的Warning.网上搜了一些办法,总结一下。 #if __has_feature(objc_arc) && clang_major >= 3 #define PP_ARC_ENABLED 1 #endif // __has_feature(objc_arc) #if PP_ARC_ENABLED #define PP_RETAIN(xx) (xx) #define PP_RELEASE(xx) xx = nil #define PP_AUTORELEASE(xx) (xx) #else #define PP_RETAIN(xx) #define PP_R…
2012-12-18 10:40 · ios开发学习相关
ios 动画
//开启动画效果代码 [uiview animatewithduration:2 animations:^{ //动画 } completion:^(bool finish){ //最后位置 self.searchtext.frame = CGRectMake (0,100,200,31); }]; //长按闪动效果 [uiview animatewithduration:0.3 delay:0 options:uiviewanimationoptionallowuserinteraction animations:^{ cell.contentview.backgroundcolor = …
2012-12-14 13:36 · ios开发学习相关
ios 修改工程名
3.2版本的话可以直接在Xcode的Project下面的Rename修改,而其他的以前版本使用: 1、直接修改info里面的Bundle display name,这个方法只是修改了在模拟器上显示的icon下面的app文字,其他的象Products下面的xx.app,Targets下面的xx,Executables下面的xx等都没有修改。 2、如果要修改products下面的xx.app的名字,就需要修改Project->Edit active target->Build->Product Name。 3、如果要修改targets、executables下面的名字,就修改Project->E…
2012-12-12 20:30 · ios开发学习相关
iOS SEL类型iOS SEL类型
bjective-C在编译的时候,会根据方法的名字(包括参数序列),生成一个用 来区分这个方法的唯一的一个ID,这个ID就是SEL类型的。我们需要注意的是,只要方法的名字(包括参数序列)相同,那么它们的ID都是相同的。就是 说,不管是超类还是子类,不管是有没有超类和子类的关系,只要名字相同那么ID就是一样的。 我们可以方便的通过方法的名字,获取到方法的ID也就是我们所说的SEL,反之亦然。具体的使用方法如下: 1 SEL 变量名 = @selector(方法名字); 2 SEL 变量名 = NSSelectorFromString(方法名字的字符串); 3 NSString *变量名 = N…
2012-12-11 10:50 · ios开发学习相关
长按地图获取经纬度 添加图钉
长按地图获取经纬度 UILongPressGestureRecognizer *lpress = [[uilongpressgesturerecognizer alloc] initWithTarget:self action:@selector(longPress:)]; lpress.minimumPressDuration = 0.3;//按0.5秒响应longPress方法 lpress.allowableMovement = 10.0; //给MKMapView加上长按事件 [mapview addgesturerecognizer:lpress];//mapView是MKMapV…
2012-12-07 17:09 · ios开发学习相关
ios 手势识别
转自http://blog.csdn.net/likendsl/article/details/7554150 一、概述 iPhone中处理触摸屏的操作,在3.2之前是主要使用的是由UIResponder而来的如下4种方式: (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *…
2012-12-05 13:36 · ios开发学习相关
MKMapView 显示当前位置
//显示地图 MKMapView *mapView = [[mkmapview alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; mapView.showsUserLocation = YES; [self.view addsubview:mapview]; //显示当前用户经纬度,自动缩放到1000米 CLLocationManager *locationManager = [[cllocationmanager alloc] init];//创建位置管理器 locationManager.delegate=self;//设置代理 locat…
2012-12-03 17:14 · ios开发学习相关
imageView setImageWithURL
success:^(UIImage *image, BOOL cached) { } failure:nil];
2012-11-30 23:24 · ios开发学习相关
uiimageview 自适应
detailImageView.contentMode = UIViewContentModeScaleAspectFit;
2012-11-30 13:00 · ios开发学习相关
status bar 半透明
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // Custom initialization self.wantsFullScreenLayout = YES; } return self; } [[uiapplication sharedapplication] setStatusBarHidden:hideEna…
2012-11-28 10:42
statusbar 隐藏
方法1: [[uiapplication sharedapplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; 方法2: UIView *proxyView = [[uiview alloc] initWithFrame:self.view.frame]; proxyView.hidden=YES; proxyView.autoresizingMask= self.view.autoresizingMask; [self.view.superview addsubview:proxyview]; […
2012-11-27 11:30 · ios开发学习相关
uitableview cell 数据重复
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initWithStyle:UITabl…
2012-11-26 10:58 · ios开发学习相关
uitableview 取消选择颜色
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //取消选中颜色 UIView *backView = [[uiview alloc] initWithFrame:cell.frame]; cell.selectedBackgroundView = backView; cell.selectedBackgroundView.backgroundColor = [uicolor clearcolor]; //取消边框线 [cell s…
2012-11-21 20:11 · ios开发学习相关
uitable 循环输出
for(int j=0;j<24;j++){ [headerarray addobjectsfromarray:aticket.result]; } //[headerarray addobjectsfromarray:aticket.result]; //[headerscrollview setframe:cgrectmake(0, 0, 320, 30+75*([headerarray count]/4))]; NSLog(@"%d",200+30+75*([headerarray count]/4)); [headerscrollview setbackgroundcolor:[ui…
2012-11-14 14:16
UIImageView 设置圆角
#import <QuartzCore/QuartzCore.h> CALayer *l = [uiimageview layer]; [l setmaskstobounds:yes]; [l setcornerradius:6.0]; [headerscrollview addsubview:headerimage];
2012-11-12 14:43 · ios开发学习相关
展示图片动画
//创建一个UIimageView UIImageView *gifImage = [[uiimageview alloc] initWithFrame:CGRectMake(100,100,56,56)]; NSMutableArray *images = [nsmutablearray array]; for (int i = 1; i <= 5; i ++)//该组共16张图片 { //将要播放的图片加入数组 [images addobject:[uiimage imagenamed:[nsstring stringwithformat:@"menu_0%i", i]]]; } gif…
2012-10-30 10:24 · ios开发学习相关
ios 展示gif动画
#import "SCGIFImageView.h" NSString* filePath = [[nsbundle mainbundle] pathForResource:@"1.gif" ofType:nil]; SCGIFImageView* gifImageView = [[[scgifimageview alloc] initWithGIFFile:filePath] autorelease]; gifImageView.frame = CGRectMake(0, 0, gifImageView.image.size.width, gifImageView.image.size.h…
2012-10-30 10:24 · ios开发学习相关
object-c 获得时间/时间戳 格式化时间
/** 格式化时间 timeSeconds 为0时表示当前时间,可以传入你定义的时间戳 timeFormatStr为空返回当当时间戳,不为空返回你写的时间格式(yyyy-MM-dd HH:ii:ss) setTimeZome ([nstimezone systemtimezone]获得当前时区字符串) */ -(NSString *)setTimeInt:(NSTimeInterval)timeSeconds setTimeFormat:(NSString *)timeFormatStr setTimeZome:(NSString *)timeZoneStr{ NSString *date_…
2012-10-29 10:09 · ios开发学习相关
NSNotificationCenter 例子
.h [[nsnotificationcenter defaultcenter] postNotificationName:@"wantuNewMessage" object:@"10"]; .m - (void)viewDidAppear:(BOOL)animated{ [[nsnotificationcenter defaultcenter] addObserver:self selector:@selector(showNewMessage:) name:@"wantuNewMessage" object:nil]; } - (void)viewDidDisappear:(BOOL)a…
2012-10-26 13:56 · ios开发学习相关
ios自定义BadgeValue
// // ViewController.m // Badge // // Created by Bo Xiu on 12-10-23. // Copyright (c) 2012年 Bo Xiu. All rights reserved. // #import "ViewController.h" #import "JSBadgeView.h" #import <QuartzCore/QuartzCore.h> #define kViewBackgroundColor [uicolor colorwithred:0.357 green:0.757 blue:0.357 alpha:1] #…
2012-10-23 16:14 · ios开发学习相关