iphone - 在 iPhone 中添加 UILabel

标签 iphone uilabel

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

我如何添加标签来执行相同的操作。有谁知道。?需要帮助。

谢谢, 世斌

最佳答案

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

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

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

然后您可以在单元格中指定将使用以下方式显示的副标题

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

关于iphone - 在 iPhone 中添加 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2144651/

相关文章:

ios - 为什么我的时间 UILabels 从暂停状态恢复播放时会跳过 2 秒?

ios - ios UILabel setFrame错误

ios - 带有圆角、投影和背景图案的 UILabel

ios - 如何给我的标签上课?

iphone - Interface Builder 文件中的未知类 myView

iphone - 让 iPhone 应用程序与 OSX 应用程序通信

iphone - 更改 uiwebview div 对象的内容

iphone - 应用程序促销网站 - 横向 iPhone 应用程序网站模板

iphone - 无法将手势识别器应用于导航栏

ios - 将 "stolen"UILabel 层添加到其他 CALayer 的子层是否安全?