// Specify the tableview Data Source
Tableview. datasource = self;
// Specify the tableview proxy
Tableview. Delegate = self;
// Configure the color of the index value
Tableview. sectionindexcolor = [uicolor lightgreencolor];
// Set the headerview of tableview (the view displayed at the top)
Uilabel * phonelabel = [[uilabel alloc] initwithframe: cgrectmake (0, 0,320, 40)];
Phonelabel. textcolor = [uicolor lightgreencolor];
Phonelabel. Text = @" 888888 ";
Phonelabel. textalignment = nstextalignmentcenter;
Tableview. tableheaderview = phonelabel;
Release_safe (phonelabel );
// Set the split line style
// Tableview. separatorstyle = uitableviewcellseparatorstylesinglelineetched;
// Set the split line color
Tableview. separatorcolor = [uicolor purplecolor];
Self. navigationitem. Title = @ "lanou ";
// Set the Row Height of tableview
Tableview. rowheight = 70;
// Obtain the file path
Nsstring * Path = [[nsbundle mainbundle] pathforresource: @ "student" oftype: @ "plist"]
// Initialize an OC dictionary object based on the file path
Nsdictionary * DIC = [nsdictionary dictionarywithcontentsoffile: path];
// Set the Row Height
-(Cgfloat) tableview :( uitableview *) tableview heightforrowatindexpath :( nsindexpath *) indexpath
{
// The cell height of an even number is 100, and the cell of an odd number is 50.
If (indexpath. Row % 2 ){
Return 100;
}
Return 50;
}
// Set the index value on the Right of tableview (used to quickly locate the partition for ease of searching ).
//-(Nsarray *) sectionindextitlesfortableview :( uitableview *) tableview
//{
// Return self. titles;
//}
//// Set the text displayed at the end of the partition
//-(Nsstring *) tableview :( uitableview *) tableview titleforfooterinsection :( nsinteger) Section
//{
// Return nil;
//}
//// Set the text displayed in each partition Header
//-(Nsstring *) tableview :( uitableview *) tableview titleforheaderinsection :( nsinteger) Section
//{
// Return self. Titles [section];
//}
// Return the number of tableview partitions --- 1
//-(Nsinteger) numberofsectionsintableview :( uitableview *) tableview
//{
// Return [self. Names count];
//}
// Set the number of rows in tableview (the number of rows in each group) ------ 2
-(Nsinteger) tableview :( uitableview *) tableview numberofrowsinsection :( nsinteger) Section
{
// Obtain key = self. Titles [section] First
// Key to obtain the corresponding array nsarray * value = self. Names [Key]
// Calculate the number of arrays [value count]
Nslog (@ "3% lD", (long) Section );
Return 1000; // [self. Names [self. Titles [section] Count];
}
// Create a cell. each row of the cell corresponds to a cell. ----- 3
-(Uitableviewcell *) tableview :( uitableview *) tableview cellforrowatindexpath :( nsindexpath *) indexpath
{
/*
Uitableviewcellstyledefault, only textlabel
Uitableviewcellstylevalue1, textlabel on the left detaillabel on the right
Uitableviewcellstylevalue2, textlabel on the right detaillabel on the left
Uitableviewcellstylesubtitle textlabel on detaillabel under
*/
// Uitableviewcell * cell = [[uitableviewcell alloc] initwithstyle: uitableviewcellstyledefault reuseidentifier: Nil];
// Cell. textlabel. Text = self. Names [indexpath. Row]; // No group
// Group
// Obtain the key
// Obtain value
// Retrieve the element
// Cell. textlabel. Text = self. Names [self. Titles [indexpath. Section] [indexpath. Row];
// Cell. textlabel. Text = self. Names [indexpath. Section] [indexpath. Row];
// Return [Cell autorelease]; //
//
// Cell. textlabel. Text = [nsstring stringwithformat: @ "% d", indexpath. Row];
// Return cell;
Tableview attribute settings