摘要:
CGRect rect = [tableView convertRect:[tableView rectForRowAtIndexPath:indexPath] toView:[tableView superview]]; 阅读全文
摘要:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; cell.textLab... 阅读全文
摘要:
oc;有2种定义变量的方式1.在 @interface :NSObject{} 的括号中,当然NSObject 是指一个父类,可以是其他的。形式如下:1234@interface GCTurnBasedMatchHelper : NSObject {BOOL gameCenterAvailable;BOOL userAuthenticated;}2.另外一种是直接在 @interface : NSObject{}括号之后,用 @property 去定义一个变量。[objc]@property (assign, readonly) BOOL gameCenterAvailable;[/objc] 阅读全文
摘要:
retain----retainCount -1; nil----retainCount =0;1Retain,alloc,initintmain(intargc,char*argv[]){ NSAutoreleasePool*pool=[[NSAutoreleasePoolalloc]init]; SomeClass*object=[[SomeClassalloc]init]; NSLog(@"1,object retain count is :%d",[objectretainCount]); [objectretain]; NSLog(@"2,object 阅读全文
摘要:
http://my.oschina.net/plumsoft/blog/55927 阅读全文
摘要:
1、将UTF8编码转化为中文 - NSString方法NSString* strAfterDecodeByUTF8AndURI = [@"%E4%B8%AD%E5%9B%BD" stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 2、将中文编码转化为utf8编码 - NSString方法 NSString *y=@"http://********/成都"; NSString *urlstr=[y stringByAddingPercentEscapesUsingEncod 阅读全文
摘要:
-(void)changeButtonFont:(UIView *)aView withColorFlag:(int) i{ if ([aView isKindOfClass:[UILabel class]]) { UILabel *lb = (UILabel *)aView; if (i==1) { [lb setTextColor:[UIColor whiteColor]]; }else { [lb setFont:[UIFontsystemFontOfSize:13]]; [lb setTextColor:[UIColor blackCol... 阅读全文
摘要:
一 、 1、直接在需要传递数据的文件种声明protocol。 A.h//需要传递数据的文件 @property(retain,nonatomic)id<FinanceStreetDelegate> delegate; @end @protocol FinanceStreetDelegate <NSObject> -(void)showCreditInfo:(NSString*)userId; @end A.m中协议的方法,通过参数传递数据 [self.delegate showCreditInfo:@"23"]; ... 阅读全文
摘要:
1.webview UIWebView *photoWebView; NSURL *url =[NSURL URLWithString:urlString]; NSURLRequest *request =[NSURLRequest requestWithURL:url]; [photoWebView loadRequest:request];2、uiimageview NSURL *url=[NSURLURLWithString:url]; UIImage *imagea = [UIImageimageWithData: [NSDatadata... 阅读全文
摘要:
1、复杂的。 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(13, 10, 380, 30)]; UIFont *font = [UIFont fontWithName:@"Helvetica" size:15.0]; [label setFont:font]; [label setNumberOfLines:0]; //设置为0时才可以label才可以根据字体的个数自动改变高度。 [label setBackgroundColor:[UIColorblueColor]]; NSString *tex. 阅读全文