Tarena代码-一些代码碎片
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];
總結
以上是生活随笔為你收集整理的Tarena代码-一些代码碎片的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python 如何绘制分叉图
- 下一篇: Linux命令之压缩zip