tableview幾乎是ios裡面最常用的布局了,這裡用純**的方式實現了自定義列表cell的介面
自定義cell
//
// cardlist
//// created by yxhe on 16/5/17.
//@end
//
// customcellview.m
// cardlist
//// created by yxhe on 16/5/17.
//#import "customcellview.h"
#define logo_width 152
#define logo_height 58
@inte***ce customcellview ()
@end
@implementation customcellview
#pragma mark - cellview delegate
- (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier
// [self setneedsdisplay]; //refresh the cell?
// nslog(@"custome cell init");
return self;
}- (void)setselected:(bool)selected animated:(bool)animated
#pragma mark - called by other objects
//custom the cell string logo and row color
- (void)settextlabel:(nsstring *)cardnumberstr withimage:(uiimage *)img atrow:(nsinteger)row
@end
主view裡面繫結關聯
#pragma mark - view delegate
- (void)viewdidload
資料是從json檔案裡讀取的
#pragma mark - tableview delegate
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath
- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath
列表自定義
github:
cardlist
iOS基礎開發 自定義控制項
自定義控制項,設定子控制項的尺寸和位置 當系統提供的控制項滿足不了我們的需求,我們可以自定義乙個控制項,繼承系統自帶的控制項,寫乙個屬於自己的控制項.自定義控制項的好處是可以把封裝控制項內部的細節,不容易被外界隨意修改.如果乙個view內部的子控制項比較多,一般會考慮自定義乙個view,把它內部子控...
iOS開發 自定義併發NSOperation實戰
前一章節已經介紹了如何自定義併發nsoperation,本節將其應用到具體例項,如果自定義併發nsoperation不會,請移步 在zccurrentoperation.h檔案中 如下 zccurrentoperation.h 自定義非併發nsoperation created by mrzhao ...
IOS開發自定義CheckBox控制項
ios本身沒有系統的checkbox元件,但是實際開發中會經常用到,所以專門寫了乙個checkbox控制項,直接上 效果圖 uicheckboxbutton.h檔案如下 import import common.h inte ce uicheckboxbutton uicontrol uilabel...