嗨,我是iOS編程新手,需要一點幫助。iOS單元格標籤鏈接
我有一個表格視圖單元格由.plist文件中的數據填充。我需要能夠在其中一個單元格內建立鏈接。我怎麼能這樣做?
這裏是一個加載數據到細胞中的代碼:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CustomTableCell";
static NSString *CellNib = @"DetailViewCell";
DetailViewCell *cell = (DetailViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil];
cell = (DetailViewCell *)[nib objectAtIndex:0];
}
cell.accessoryType = UITableViewCellAccessoryNone;
cell.cellTitleLabel.textColor = [UIColor blackColor];
cell.cellTitleLabel.font = [UIFont systemFontOfSize:20.0];
cell.cellSubtitleLabel.textColor = [UIColor darkGrayColor];
informations = [[NSArray alloc] initWithObjects:@"City", @"Country", @"State", @"History", @"Link", nil];
subtitles = [[NSArray alloc] initWithObjects:titleString, subtitleString, stateString, populationString, @"Link", nil];
cell.cellTitleLabel.text = [informations objectAtIndex:indexPath.row];
cell.cellSubtitleLabel.text = [subtitles objectAtIndex:indexPath.row];
return (DetailViewCell *) cell;
}
對於小區「一線通」我需要它來打開存儲在該的.plist文件的URL。我怎麼能這樣做?
非常感謝
瑞安
PS:我在這個東西是一個新手,所以是描述性的。由於
這是我可以建議的想法之一。創建一個新視圖由上面類的UIWebView&in'didSelectRowAtIndexPath'方法組成,您可以檢查該'鏈接'單元的'indexpath'。並在新創建的UIWebView中打開該單元格中的網址。 –