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];
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];
相关文章推荐
- 一些ASP初学者常用的代码
- duwamish7的一些代码分析总结
- VBA中的一些代码
- 值得收藏的一些代码
- 网页制作的中的一些工具代码
- 一些实用的 Javascript 代码
- 一些珍藏代码
- 整理了一些asp初学者常用的代码 (4)
- 整理了一些asp初学者常用的代码 (6)
- 代码维护:改进代码的一些方法
- 一些页面常见的问题与解决代码
- CodeProject上最近(2004-10-15)的一些好代码
- VBA中的一些代码
- Remoting基本实现的一些代码样例程序
- 一些实用的 Javascript 代码
- 一些js代码
- 一些js的代码下载链接
- 整理了一些asp初学者常用的代码 (1)
- 一些珍藏代码奉献,绝对有价值,不可不看!!!
- 网页制作的中的一些工具代码