Skip to content

Commit

Permalink
dev:修改了cell中的显示数据,标题和时间
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyufeng1991 committed Nov 13, 2015
1 parent acf7f45 commit 2f168f2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Oncenote/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5Sh-dK-bIY" id="JSL-YX-K0G">
<rect key="frame" x="0.0" y="0.0" width="296" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="oOV-Vz-A6z">
<rect key="frame" x="8" y="11" width="204" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="time" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Kir-Id-JmJ">
<rect key="frame" x="229" y="11" width="67" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
Expand Down
33 changes: 30 additions & 3 deletions Oncenote/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ @interface ViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *noteTableView;//“笔记”的TableView


@property(nonatomic,strong) NSArray *noteArray;
@property(nonatomic,strong) NSArray *noteTitleArray;
@property(nonatomic,strong) NSArray *noteTimeArray;

@end

Expand All @@ -33,7 +34,8 @@ - (void)viewDidLoad {
[self setNavigationBarItemButton];

//添加数据
self.noteArray = [[NSArray alloc] initWithObjects:@"1",@"2",@"3", nil];
self.noteTitleArray = [[NSArray alloc] initWithObjects:@"1",@"2",@"3", nil];
self.noteTimeArray = [[NSArray alloc] initWithObjects:@"2015.10.1",@"2011.1.1",@"1991.12.12", nil];


}
Expand Down Expand Up @@ -125,12 +127,37 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
/*
let cell = self.priceManagementTableView.dequeueReusableCellWithIdentifier("priceManagementCell")
if(indexPath.row == 0){
let title = cell!.viewWithTag(101) as! UILabel
let desc = cell!.viewWithTag(102) as! UILabel
title.text = priceManagementContentName[indexPath.row]
desc.text = filterDescriptionXML.filterDescriptionXMLCharacter(priceManagementContent[indexPath.row])
// desc.text = priceManagementContent[indexPath.row]
}
else{
let title = cell!.viewWithTag(101) as! UILabel
title.text = priceManagementContentName[indexPath.row]
}
*/


//设置TableView的圆角;
tableView.layer.cornerRadius = 10;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NoteCell" forIndexPath:indexPath];
cell.textLabel.text = [self.noteArray objectAtIndex:indexPath.row];

UILabel *noteTitle = (UILabel*)[cell viewWithTag:101];
UILabel *noteTime = (UILabel*)[cell viewWithTag:102];

noteTitle.text = [self.noteTitleArray objectAtIndex:indexPath.row];
noteTime.text = [self.noteTimeArray objectAtIndex:indexPath.row];

return cell;

}
Expand Down

0 comments on commit 2f168f2

Please sign in to comment.