2010-01-27 55 views
3

我有一个tableView显示歌曲列表,当我点击任何一个它播放。在iPhone中添加一个UILabel

-(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 requestWithURL:url]; 

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

}

这是它是如何被播放。 问题是,播放时显示歌曲的URL。我打算在它上面添加一个标签。这样我就可以将标签文本设置为歌曲名称。

我如何添加一个标签来做同样的事情。有谁知道。?需要帮忙。

感谢, 世斌

+0

请张贴代码为UI歌曲播放时,可以显示电池的字幕。 – kennytm 2010-01-27 06:01:22

+0

什么是一个Song.Link的内容,张贴出来的字符串 – PirosB3 2010-02-02 22:47:43

回答

2

真的需要更多的信息来回答这个问题,但它听起来像你想在你的表视图两个文本字段。

当创建UITableViewCell使用UITableViewCellStyleSubtitle样式创建它时。

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

然后,您可以指定将使用

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