您的位置:首页 > 编程语言

Tarena代码-一些代码碎片

2015-01-08 13:19 274 查看
retain

release

autorelease

alloc new copy

字典
数组

[View addsubView:view];

set方法

-(void) setUIImageView:imageView;

class Test{

@(property) UIImageView* myImage;

}

UIImageView* _myImage;

-(UIImageView*) myImage {//get方法

return _myImage;

}

-(void) setMyImage:(UIImageView*)imageVIew {

//判断是否自负值

if(_myImage = imagerView ) return;//释放原有内存空间, 指针指向的原来的对象的 引用计数器-1

[_myImage release];

//拷贝地址

_myImage = imageView;

//给指针指向的新的对象的 引用计数器+1

[_myImage reatin];

}

void init{

_myImage = [UIImageView imageView]; //0

self.myImage = [UIImageView imageView]; //1

self.myImage = [[[UIImageView alloc]init ] autorelease]; //1

_myImage = [[UIImageView alloc]init ] ;//1

}

void test{

_myImage

}

#pragma mark --开启显示底部
- (void)viewWillAppear:(BOOL)animated
{[self.chatTableView setContentOffset:CGPointMake(CGFLOAT_MAX, CGFLOAT_MAX)];
}

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated

PayReq *request = [[PayReq alloc] init];

request.openID=@"wxd930ea5d5a258f4f";

request.partnerId = @"1900000109";//[resultDic objectForKey:@"partnerid"];

request.prepayId= @"1101000000140429eb40476f8896f4c9";//[resultDic objectForKey:@"partnerid"];

request.package = @"Sign=WXpay";

request.nonceStr= @"139042a4157a773f209847829d80894d";//[resultDic objectForKey:@"noncestr"];

NSString *timeStamp = [NSString stringWithFormat:@"%@", @"1398746574"];

request.timeStamp = [timeStamp intValue];

request.sign= @"7ffecb600d7157c5aa49810d2d8f28bc2811827b";//[resultDic objectForKey:@"sign"];

// [WXApi safeSendReq:request];

[WXApi sendReq:request];

PayReq *request = [[PayReq alloc] init];

request.openID=@"wxd930ea5d5a258f4f";

request.partnerId = @"1900000109";//[resultDic objectForKey:@"partnerid"];

request.prepayId= @"1101000000140429eb40476f8896f4c9";//[resultDic objectForKey:@"partnerid"];

request.package = @"Sign=WXpay";

request.nonceStr= @"139042a4157a773f209847829d80894d";//[resultDic objectForKey:@"noncestr"];

NSString *timeStamp = [NSString stringWithFormat:@"%@", @"1398746574"];

request.timeStamp = [timeStamp intValue];

request.sign= @"7ffecb600d7157c5aa49810d2d8f28bc2811827b";//[resultDic objectForKey:@"sign"];

// [WXApi safeSendReq:request];

[WXApi sendReq:request];

// --- 获取当前连接上得wifi信息 ---

- (id)getWiFiInfo

{

NSArray *ifs = (__bridge id)CNCopySupportedInterfaces();

id info = nil;

for (NSString *ifnam in ifs) {

info = (__bridge id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);

if (info && [info count]) {

break;

}

}

return info;

}

#import <SystemConfiguration/CaptiveNetwork.h>

}

//一个section刷新

NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];

[tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];

//一个cell刷新

NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3 inSection:0];

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: