【问题标题】:Add a UILabel in iPhone在 iPhone 中添加 UILabel
【发布时间】:2010-01-27 04:50:53
【问题描述】:

我有一个 tableView,它显示歌曲列表,当我点击任何一首歌曲时,它就会播放。

-(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。我打算在它上面添加一个标签。这样我就可以将标签文本设置为歌曲名称。

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

谢谢, 世斌

【问题讨论】:

  • 请在播放歌曲时发布UI代码。
  • aSong.Link的内容是什么,把字符串贴出来

标签: iphone uilabel


【解决方案1】:

确实需要更多信息来回答问题,但听起来您希望在表格视图中有两个文本字段。

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

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

然后您可以在单元格中指定要显示的副标题

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-19
    相关资源
    最近更新 更多