我想做一个UITableViewCell更大的.我怎么能这样做,我试过调整它的框架,但没有任何反应.我能做什么?
我试图用代码推入一个新的视图控制器:
[self.navigationController pushViewController:webViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)
但它不起作用.在表视图中选择单元格时会发生此代码.我有一个表视图,我认为这是防止这种情况发生的.我试过以模态方式呈现它,但摆脱了导航栏,我不能回去.有一个非常类似于此但答案对我不起作用!
UPDATE
- (void)loadView {
// Create an instance of UIWebView as large as the screen
CGRect screenFrame = [[UIScreen mainScreen] applicationFrame];
UIWebView *wv = [[UIWebView alloc] initWithFrame:screenFrame];
// Tell web view to scale web content to fit within bounds of webview
[wv setScalesPageToFit:YES];
[self setView:wv];
[wv release];
}
Run Code Online (Sandbox Code Playgroud)
将Web视图作为WebViewController的视图
如上所示没有笔尖
使用NSLog查询didSelect单元格方法以查找
一切都被初始化和分配,非零
更新:
我做了选择细胞方法:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Push the web view controller onto the navigaton stack - this implicity
// creates the …Run Code Online (Sandbox Code Playgroud) xcode objective-c uitabbarcontroller uinavigationcontroller pushviewcontroller
我想查看一个字符串,它是apple rss新闻源上帖子的标题是否包含子字符串,例如"Steve"或"Jobs".我把帖子组织成了一个uitableview.
所以有一个帖子里有史蒂夫或乔布斯的标题所以我用它来检查:
if ([[entry title] localizedCaseInsensitiveCompare:@"Steve"] == NSOrderedSame || [[entry title] localizedCaseInsensitiveCompare: @"Jobs"] == NSOrderedSame) {
NSLog(@"Comparism of Steve Jobs");
cell.imageView.image = [UIImage imageNamed:@"steve.png"];
}
Run Code Online (Sandbox Code Playgroud)
但它从未调用过,entry是一个包含标题的RSSItem类 - 条目及其标题不是我的问题,我已经检查过.我的比较是问题所在.我如何比较
UPDATE!
好的,这里是代码:
NSRange range = [[[cell textLabel] text] rangeOfString:@"Steve" options:NSCaseInsensitiveSearch];
if (range.location != NSNotFound)
{
cell.imageView.image = [UIImage imageNamed:@"steve.png"];
}
Run Code Online (Sandbox Code Playgroud)
我已尝试过其他人的方式,但同样的结果:
有些单元格的imageView为steve.png,即使它们的标题不包含史蒂夫作业.奇怪的???我向下滚动,当我回到原位时,所有重新分配和初始化的出列单元都有史蒂夫作业图片.在我打开应用程序的时候,一些在标题中没有史蒂夫的细胞都有了图像,然后发生了上述情况.
我需要的周围代码如下:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"UITableViewCell"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"UITableViewCell"]
autorelease];
}
tableView.autoresizingMask = 5;
tableView.autoresizesSubviews …Run Code Online (Sandbox Code Playgroud) 我有一个RSS提要阅读器应用程序,每个单元格从RSS提要苹果网站的XML中的元素中收集标题.现在标题很长,所以我想做的是使用以下方法增加每个单元格的大小:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 80;
}
Run Code Online (Sandbox Code Playgroud)
使标题分成两行或多行并展开,但文字继续直行并切断.我怎样才能解决这个问题?