开发者

Add a UILabel in iPhone

I have a tableView which displays a list of songs, when i tap on any one it gets played.

-(void) PlaySelectedSong:(id) sender{       
Song *aSong=[aCategory.Items objectAtIndex:appDelegate.selectedSong];
NSString *content1=[[NSString alloc] initWithFormat:@"http://192.168.50.108:8888/%@",[aSong.Link stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];

NSLog(content1);
NSURL *url=[NSURL URLWithString:content1];

NSURLRequest *requestObj = [NSURLRequest requestWithU开发者_运维百科RL:url];

//Load the request in the UIWebView.
webView.delegate=self;
[webView loadRequest:requestObj]; 

}

This is how it get played. The problem is that while playing it is showing the URL of the song. i am planning to add a label above it. so that i can set the label text to the song name.

How do i add a label to do the same. Any one knows.? Need Help.

Thanks, Shibin


Really need more information to answer the question but it sounds like you want to have two text fields in your table view.

When creating the UITableViewCell create it using the UITableViewCellStyleSubtitle style.

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                               reuseIdentifier:cellIdentifier] autorelease];

You can then specify a subtitle in the cell that will be displayed using

cell.textLabel.text = songTitle;
cell.detailTextLabel.text = songUrl;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜