我一直到处都是,似乎UITableView有一个静态的背景问题有很好的记录,但没有人有一个直接的解决方案?我TableViews完全用代码构建我,像这样:
UIViewController *tableViewController = [[TableViewController alloc] init];
navigationController = [[UINavigationController alloc]
initWithRootViewController:tableViewController];
[tableViewController release];
[window addSubview:navigationController.view];
Run Code Online (Sandbox Code Playgroud)
该窗口是我UIWindow在app delegate中的主要构建.从这里开始,我需要构建一些不同的TableViews(由控制navigationController),一些与fetchedResultsControllers自定义单元格等等.我更喜欢在代码中完全执行此操作,而不是使用nib,因为这会导致在代码和IB之间传播自定义,或者必须构建和维护6个以上的不同Nib.
我根本找不到一个工作示例,其中一个tableViewController类设置它自己的背景图像.如果我在其中一个TableViews(扩展UITableViewController)中执行此操作:
self.tableView.backgroundColor = backgroundColor;
Run Code Online (Sandbox Code Playgroud)
当然,我得到了tableView的背景颜色(这样也可以使细胞的颜色顺序着色,认为细胞从颜色中继承了它们的颜色tableView?)但是我希望有一个静态的背景图像,我的细胞可以上下滑动.不是用户手势上下滑动的"背景图像".正是GroupedStyle tableView提供的,但在PlainStyle tableView :) ..并使用代码完成,而不是IB.
我想我必须清除表格视图的背景颜色,然后在配置它们时设置单元格颜色,这样它们就不会透明.然后以某种方式"偷偷"从tableView实例里面的tableView视图下面隐藏一个背景图片?
我将如何解决这个问题,最好的解决方案是能够在viewDidLoad或我的TableViewController中的任何其他函数中执行此操作,以便将我的所有自定义保存在一个位置.
希望有人可以帮助我,我所有'谷歌搜索':)谢谢!
我在尝试更改剪切/复制/粘贴行为时遇到了很大问题UITextView.我想要实现的是:检测用户何时粘贴了一些文本UITextView.当我发现这个时,我会检查数据并做我的事情.
根据文件,我发现了UIResponder.
所以我创建了一个继承的简单类UITextView.在.m文件中我创建了一个名为的函数.
-(void) paste:(id)sender{
NSLog(@"paste button was pressed do something");
}
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,似乎永远不会开火.我可以让select语句工作并跟踪数据.
-(void) select:(id)sender
Run Code Online (Sandbox Code Playgroud)
1.这是在UITextView中检测粘贴的正确方法吗?2.现在我正在跟踪购买多少字符UITextView更改,如果它大于一个字符,那么我怀疑它可能是一个粘贴操作.但由于iPhone可以自动完成单词,例如Wedn(到周三),它可能不是粘贴操作.
在Interface Builder中,我在我的NIB文件中选择了我的textView,然后选择了它的"类标识"到我几乎创建的类之前,我知道这个文件是作为子类工作的,但它只是不响应粘贴事件.
谢谢.
我已经阅读了文档和几个例子,但仍然无法理解何时使用一个CATransformLayer.正常情况CALayer下,z = 0平面上的所有东西都会变平,但这不是什么CATransformLayer意思吗?数学解释会非常有用.
我正在开发一个使用Google应用引擎托管后端的iPhone应用程序.我需要通过Google进行身份验证,但我似乎无法从我的应用中找到一种方法.我似乎是UIWebView要让用户登录我从谷歌获得的重定向登录页面,但我宁愿让用户输入一次凭据,然后让它持续存在,除非用户退出.
这可能吗?我应该查看其他选项还是我没有正确处理重定向?
任何建议或信息将不胜感激.
谢谢
我尝试添加各种UIImages之下UIImageView,让他们与滚动UIScrollView.我不知道如何在其下添加各种图像UIImageView并让它们滚动.下面是我的代码,它添加了一个图像UIImageView并使其可滚动.
- (void)viewDidLoad {
[super viewDidLoad];
UIImage *image = [UIImage imageNamed:@"ae.jpg"];
imageView = [[UIImageView alloc]initWithImage:image];
imageView.frame = [[UIScreen mainScreen] bounds];
imageView.contentMode = (UIViewContentModeScaleAspectFit);
imageView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
imageView.backgroundColor = [UIColor clearColor];
UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
scrollView.contentMode = (UIViewContentModeScaleAspectFit);
scrollView.contentSize = CGSizeMake(image.size.width,960);
scrollView.pagingEnabled = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.alwaysBounceVertical = NO;
scrollView.alwaysBounceHorizontal = NO;
scrollView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
scrollView.maximumZoomScale = …Run Code Online (Sandbox Code Playgroud) 我有UICollectionView一个自定义的实现UICollectionViewCell.从互联网获取数据阵列,但是当用户访问内容时下载图像.
虽然这可能不是最有效的方式,我不打算以这种方式离开它,它确实暴露了我正在努力解决的某个问题.看起来细胞正在显示"缓存"或"旧"图像,当我慢慢滚动集合视图时,细胞图像不断变化.
这可能是一个问题,实际的细胞图像在那个时刻无法从网上获得,我的问题是如何强制空单元格或某些加载活动监视器而不显示不正确的图像?
提前谢谢,小齿轮
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * CellIdentifier = @"Event";
EventCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
NSString *title = [[events objectAtIndex:indexPath.item] objectForKey:@"title"];
NSString *imageUrl = [[[events objectAtIndex:indexPath.item] objectForKey:@"photo"] objectForKey:@"url"];
dispatch_queue_t imageFetchQ = dispatch_queue_create("image fetched", NULL);
dispatch_async(imageFetchQ, ^{
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];
if (imageData)
{
dispatch_async(dispatch_get_main_queue(), ^{
cell.eventImage.image = [UIImage imageWithData:imageData];
cell.eventTitle.text = title;
});
}
});
return cell;
}
Run Code Online (Sandbox Code Playgroud) 我在使用XCode 5时遇到了麻烦.昨天一切都很好.今天,当我尝试在iPhone 5或iPad Mini上运行我的应用程序时,出现以下错误:
iOS deployment target '7.0' for architecture 'armv7s' and variant 'normal' is greater than the maximum value '6.1.99' for the iOS 6.1 SDK.
Run Code Online (Sandbox Code Playgroud)
基础SDK和部署目标都是iOS 7(最新版本).我在两台设备上都安装了iOS7.当我尝试在iOS7的模拟器上启动应用程序时,一切都很好.我试图清理项目,重新启动XCode和MAC,查看project.pbxproj - 仍然无法理解是什么.所以,任何帮助都会非常棒!
基础SDK:
部署目标:

当用户选择行时,我想更改a UIImage里面的内容UITableViewCell.多数民众赞成在现在太难了.我可以做得didSelectRowAtIndex很好.然而,继续问题,我希望其他单元格(每个单元格cell都有标准图像)再次获得标准图像.(如果单元格再次具有标准图像,则应"标记"所选图像(意味着未标记的图像将被标记的图像替换,我已经有了代码)
把它看成是Checkbox你所知道的HTML.
这是我的尝试:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView cellForRowAtIndexPath:indexPath];
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:YES];
//Little flashing animation
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[UIView animateWithDuration:2.0f animations:^{
} completion:^(BOOL finished) {
;
}];
//Mark the selected cell
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
ALog(@"%i", cell.imageView.tag);
ALog(@"%i", [[[tableView cellForRowAtIndexPath:indexPath] imageView] tag]);
UIImageView *iconimgView = (UIImageView *)[[tableView cellForRowAtIndexPath:indexPath] viewWithTag:TAG_IMAGEMARKERCELL];
[iconimgView setImage:[UIImage imageNamed:@"circle-answer-marked.png"]];
//..
}
Run Code Online (Sandbox Code Playgroud)
在UIImageView这里定义:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static …Run Code Online (Sandbox Code Playgroud) 我有一个UITableView通过CoreData填充,并且刚刚注意到一些奇怪的东西.我在UITable中大约有20行,当我向下滚动表并再次向上时,单元格的标签会被写在现有文本的顶部,并且每次我再次向上和向上时都会继续执行.我的代码CellForRowAtIndexPath是:
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//Some constants ---
const NSInteger TOP_LABEL_TAG = 1001;
const NSInteger BOTTOM_LABEL_TAG = 1002;
UILabel *topLabel;
UILabel *bottomLabel;
const CGFloat LABEL_HEIGHT = 20;
//CGRect Imageframe = CGRectMake(7, 5, 35, 35);
//----
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.font = [UIFont …Run Code Online (Sandbox Code Playgroud) 我正在使用一个水平选择器UICollectionView.它很简单:A UIView以UICollectionView编程方式创建,使用UICollectionViewFlowLayout一个部分,滚动设置为水平.它出现在屏幕上,在正确的单元格中显示正确的数据.但它不会滚动 - 实际上它根本不响应用户交互.
这是视图的初始化程序:
- (id)initWithFrame:(CGRect)frame andItemData:(NSArray *)itemData
{
self = [super initWithFrame:frame];
if (self) {
_itemData = itemData;
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
[flowLayout setItemSize:CGSizeMake(kCellWidth, kCellHeight)];
[flowLayout setMinimumInteritemSpacing:0.f];
[flowLayout setMinimumLineSpacing:0.f];
_collectionView = [[UICollectionView alloc] initWithFrame:[self frame] collectionViewLayout:flowLayout];
[_collectionView setDataSource:self];
[_collectionView setDelegate:self];
[_collectionView setBounces:NO];
[_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"HorizontalPickerCell"];
[self addSubview:_collectionView];
}
return self;
}
Run Code Online (Sandbox Code Playgroud)
我尝试以编程方式设置UserInteractionEnabled为YES,但这没有任何区别(也不应该有,因为默认UserInteractionEnabled设置为YES).FWIW,集合视图使用标准UICollectionViewCells,s作为子视图UILabel添加到contentViews中. …
ios ×6
iphone ×5
objective-c ×4
uitableview ×3
uiimageview ×2
ios7 ×1
uiimage ×1
uiscrollview ×1
uitextview ×1
xcode ×1
xcode5 ×1