日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內(nèi)最全I(xiàn)T社區(qū)平臺 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁 > php開源 > 綜合技術(shù) > 仿網(wǎng)易彩票代碼實(shí)現(xiàn)

仿網(wǎng)易彩票代碼實(shí)現(xiàn)

來源:程序員人生   發(fā)布時(shí)間:2014-12-13 08:44:07 閱讀次數(shù):3935次

仿網(wǎng)易彩票代碼實(shí)現(xiàn)

1.設(shè)置全部導(dǎo)航條的背景

// 取出全部導(dǎo)航條
UINavigationBar *bar = [UINavigationBar appearance];
// 設(shè)置全部導(dǎo)航條的背景圖片
[bar setBackgroundImage:[UIImage imageName:
@"navigationbar_background.png"] forBarMetrics:UIBarMetricsDefault];
// 導(dǎo)航欄上有1層BackgroundImageView,不能直接設(shè)置背景色彩,設(shè)置背景色彩是無效的
//  bar.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"navigationbar_background.png"]];

// 設(shè)置所有導(dǎo)航條字體的色彩
NSDictionary *dict = @{NSFontAttributeName: [UIFont systemFontOfSize:15.0],NSForegroundColorAttributeName:[UIColor whiteColor]};
 [
bar setTitleTextAttributes:dict];
// 設(shè)置主題色彩
[
bar setTintColor:[UIColor whiteColor]];
2、解決IOS6和IOS7兼容性問題
程序啟動的時(shí)候,隱藏狀態(tài)欄,ios6需要恢復(fù)狀態(tài)欄顯示
設(shè)置狀態(tài)欄色彩 ios7默許狀態(tài)欄交給控制器管理,修改info.plist文件,讓狀態(tài)欄交給application管理
application.statusBarHidden = NO;
application.
statusBarStyle = UIStatusBarStyleLightContent;
3、自定義button,設(shè)置button的標(biāo)題和圖片的位置
// 設(shè)置按鈕標(biāo)題的位置
- (
CGRect)titleRectForContentRect:(CGRect)contentRect;
// 設(shè)置按鈕圖片的位置
- (CGRect)
imageRectForContentRect:(CGRect)contentRect;
// 獲得當(dāng)前文字尺寸,計(jì)算內(nèi)部Label的尺寸
NSDictionary *dict = @{NSFontAttributeName: [UIFont systemFontOfSize:15.0]};
titleW = [self.currentTitle boundingRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) options:NSStringDrawingTruncatesLastVisibleLine attributes:dict context:nil].size.width;
注意:IOS6和IOS7有兼容性問題
boundingRectWithSizeios7才有,ios6沒有這個方法。
IOS6需要用這個方法,獲得當(dāng)前文字的尺寸,計(jì)算內(nèi)部Label的尺寸。
titleW = [self.currentTitle sizeWithFont:[UIFont systemFontOfSize:15.0]].width;
4、button imagestroyboard的拉伸
注意:
通過storyboard只能拉伸UIImageView,而buttonstoryboard不能拉伸,只能用代碼實(shí)現(xiàn)。  
 storyboard x:表示左側(cè)多少不拉伸 y:表示上邊多少不拉伸 w:表示寬度拉伸多少個像素 h:表示高度拉伸多少個像素 x:0.5(左側(cè)1半不拉伸) y:0.5(頂部1半不拉伸) w:0 (寬度拉伸1個像素) h:0(高度拉伸1個像素)。
  
// 拉伸按鈕
UIImage *image = [UIImage imageNamed:@"NavButton"];
UIImage *imageH = [UIImage imageNamed:@"NavButtonPressed"];
image = [image
stretchableImageWithLeftCapWidth:image.size.width * 0.5  topCapHeight:image.size.height * 0.5];
imageH = [imageH
stretchableImageWithLeftCapWidth:imageH.size.width * 0.5 topCapHeight:imageH.size.height * 0.5];
[
_loginBtn setBackgroundImage:image forState:UIControlStateNormal];
[
_loginBtn setBackgroundImage:imageH forState:UIControlStateHighlighted];
5、UICollectionViewController
UICollectionViewController默許有1個UICollectionView,但是self.collectionView != self.view
UITableViewController默許有1個UITableView,并且self.tableview == self.view

UICollectionViewCell是不能通過代碼來創(chuàng)建的,forIndexPath意味著去stroyboard中創(chuàng)建。
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
UICollectionViewCell *cell = [[UICollectionViewCell alloc] init];
UICollectionViewCell首先會從緩存池中根據(jù)Identifier查找,如果緩存池中沒有,才會手動創(chuàng)建,但是手動創(chuàng)建init方法沒有提供標(biāo)識符的構(gòu)造方法,在做系統(tǒng)優(yōu)化的時(shí)候,就不能根據(jù)Identifier準(zhǔn)確的查找出,會引發(fā)表格的重用。

// 1.注冊cell(告知collectionView將來創(chuàng)建怎樣的cell),利用xib創(chuàng)建
UINib *nib = [UINib nibWithNibName:@"SUNProductCell" bundle:nil];
[
self.collectionView registerNib:nib forCellWithReuseIdentifier:ID];

// 2.注冊UICollectionViewCell ,如果緩存池中沒有,就會自動創(chuàng)建
[self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:ID];

注意:在使用UICollectionViewCell 必須傳入布局。
    // 1.流水布局
   
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
   
// 2.每一個cellframe
    layout.
itemSize = CGSizeMake(80, 80);
   
// 3.設(shè)置cell之間的水平間距
    layout.
minimumInteritemSpacing = 0;
   
// 4.設(shè)置cell之間的垂直間距
    layout.
minimumLineSpacing = 10;
   
// 5.設(shè)置4周的內(nèi)邊距
    layout.
sectionInset = UIEdgeInsetsMake(layout.minimumLineSpacing, 0, 0, 0);
   
return [super initWithCollectionViewLayout:layout];

使用UICollectionView 
    第1步:必須有布局
   
第2部:cell必須自己注冊
6、解析JSON數(shù)據(jù)
NSString *fileName = [[NSBundle mainBundle] pathForResource:@"products.json" ofType:nil];
NSData *data =  [NSData dataWithContentsOfFile:fileName];
NSArray *jsonArr =  [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
7、UIWebView
// 加載資源包中的html
NSURL *url = [[NSBundle mainBundle] URLForResource:_helpItem.html withExtension:nil];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView
loadRequest:request];
// 加載完網(wǎng)頁調(diào)用
- (
void)webViewDidFinishLoad:(UIWebView *)webView
{
   
NSString *str = [NSString stringWithFormat:@"window.location.href = '#%@';",_helpItem.ID];
    [webView
stringByEvaluatingJavaScriptFromString:str];
}
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 在线免费观看黄色片 | 亚洲欧美在线视频 | 天堂中文字幕在线 | 久久久精品 | 一本久久a精品一合区久久久 | 一区二区日韩精品 | 天天干,夜夜操 | 一本色道精品久久一区二区三区 | 91精品国产一区二区 | 国产精品久久久久久久久久白浆 | 国产精品一区二区三区四区 | 久久精品国产一区二区三区 | av九九| 国产伦精品一区二区 | 亚洲国产一区二区在线 | www伊人| 国产尤物一区 | 国产特级毛片aaaaaaa高清 | 国产高清一二三区 | 欧美色综合天天久久综合精品 | 2023国产精品视频 | 久久久久久午夜 | h亚洲 | 日韩成人免费电影 | 国产中文字幕一区二区三区 | 精品乱人伦一区二区三区 | 高清一二三区 | 亚洲精品久久久久久一区二区 | 国产精品久久久久久久午夜 | 精品国产一区二区三区麻豆小说 | 亚洲一区二区视频在线 | 久久之久久 | 色综合网在线观看 | jizzjizz女人水多 | www.av成人| 黄色毛片视频免费 | 日韩欧美在线一区二区 | 中文字幕免费在线视频 | 一区二区三区四区在线观看视频 | 91成人入口 | aⅴ色国产 欧美 |