Tag: 客观

iOSpipe理嵌套的UICollectionViews问题

我在处理嵌套的集合视图时遇到了一个问题。 层次如下: outerCollectionView 的UIImageView 标签 innerCollectionView 标签 的UIImageView OuterCollectionView的单元格的大小是屏幕的大小(像刷过页面一样)我已经设置了outerCollectionView的委托和数据源为UIViewController和innerCollectionView的委托和数据源为包含单元格,如下所示: 在ViewController.m中 -(FeaturedPageCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { FeaturedPageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FeaturedCell" forIndexPath:indexPath]; cell.nestedCollectionView.dataSource = cell; cell.nestedCollectionView.delegate = cell; [cell.nestedCollectionView setBackgroundColor:[[UIColor whiteColor] colorWithAlphaComponent:.01]]; cell.venueThumbnail.image = [UIImage imageNamed:[self.venueThumbnails objectAtIndex:indexPath.item]]; cell.venueNameLabel.text = [self.venueNames objectAtIndex:indexPath.item]; cell.venueNameLabel.textColor = [UIColor whiteColor]; cell.venueAddressLabel.text = [self.venueAddresses objectAtIndex:indexPath.item]; cell.venueAddressLabel.textColor = [UIColor whiteColor]; [cell setBackgroundColor:[[UIColor […]

碰撞不在物品之间工作

我在我的应用程序中使用UIDynamics。 我的应用程序有两个方块。 一个是固定的,另一个可以移动(通过应用平移手势)。 当我尝试碰撞他们时,他们不会碰撞。 委托方法永远不会被调用。 这里是我的代码,我希望有人能指出这个问题。 UIDynamicAnimator* animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; UICollisionBehavior* collisionBehavior = [[UICollisionBehavior alloc] initWithItems:@[self.square1, self.square2]]; collisionBehavior.translatesReferenceBoundsIntoBoundary = YES; UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; [self.square1 addGestureRecognizer:pan]; [collisionBehavior setCollisionMode:UICollisionBehaviorModeEverything]; [animator addBehavior:collisionBehavior]; collisionBehavior.collisionDelegate = self;

如何在多个UIViews中滑动手指时检测特定UIView中的触摸

我试图解决的情况是我有几个UIViews作为主UIView的子视图。 我想要做的是突出显示矩形,让我们说改变它的边界为一个手指滑过视图..类似于当你移动/拖动鼠标光标超过一个超文本链接时发生的事情。

如何隐藏一个静态的UITableViewCell?

你如何隐藏一个静态单元格? 我想隐藏和静态单元格,如果图像不存在。 我试过了: imageCell.hidden = YES; //did not work 我已经看到了答案,build议改变数据源或使用: – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 0;// will hide all cell } 但我无法find一个方法来做一个特定的视图单元格。 我想实现的是: if(image==nil){ //hide imageCell } 现在这里是捕获,图像被asynchronous下载,因此可能会在尝试downlaod之前调用deleguate方法。

如何从故事板返回自定义单元格高度?

早些时候,我问了一个关于如何隐藏静态单元格的问题 。 我得到的最好的答案隐藏单元格,但它然后将其他单元格高度设置为44 。 我想find一个方法来返回故事板提供的高度,因为不同的单元格可以有不同的高度。 也我的表视图分组,静态,和许多部分,如果这有助于使其更清晰。 我试过这个 – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 5 && image==nil && [indexPath section] == 1){ NSLog(@"hide cvell"); return 0; } return tableView.rowHeight; } 它似乎像return tableView.rowHeight; 还会返回44,所以没有变化:( 把它缩短,这是我需要帮助的; – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 5 && image==nil && [indexPath section] == 1){ NSLog(@"hide cvell"); […]

UITableView点击一个项目打开一个新的屏幕/视图/活动

我有一个表视图(HomeViewController)组成的项目为: 地点 报告 设置 我有这些项目作为单独的文件(LocationViewController,ReportingView控制器和设置ViewController)。现在,如果用户点击位置一个新的屏幕/活动/视图应该打开和rest项目相同。 可以有人请help.my代码是: #import "HomePageController.h" @implementation HomePageController @synthesize menuList, table; // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. – (void)viewDidLoad { menuList=[[NSMutableArray alloc] initWithObjects: [NSArray arrayWithObjects:@"LOCATIONS",nil], [NSArray arrayWithObjects:@"REPORTING",nil], [NSArray arrayWithObjects:@"SETTINGS",nil], [NSArray arrayWithObjects:@"PASSWORD",nil], [NSArray arrayWithObjects:@"HELP",nil], [NSArray arrayWithObjects:@"ABOUT",nil], [NSArray arrayWithObjects:@"SHARE",nil], nil]; [self.navigationController setNavigationBarHidden:NO]; self.navigationController.navigationBar.tintColor=[UIColor blackColor]; self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent; self.title=@"CoinRead"; […]

IOS 7如何使用UITableView的scrollToRowAtIndexPath

我是新来的IOS 7,我做了一个testing应用程序,当我想要使用scrollToRowAtIndexPath检测到左侧滑动。 滑动被检测到,但我正在努力与“自我”的定义。 我得到错误没有可见@interface为'SimpleTableViewController' – (void)handleSwipeLeft:(UISwipeGestureRecognizer *)recognizer { NSLog(@"%u = %d", recognizer.direction,recognizer.state); // jump to section 0 row 20 when leftswipe is dectected NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:20 inSection:0]; [self.tableView scrollToRowAtIndexPath:newIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO]; } 我可以发送完整的源代码,如果你想或者你可以在这里下载: www.auditext.com/xintax/SimpleTable.zip 使用self.tableView给消息Property'tableView'找不到'SimpleTableViewController'types的对象 – 它现在工作,我已经把这行添加到我的viewcontroller.h:@属性(强,非primefaces)IBOutlet UITableView * myview; NSIndexPath * loc = [NSIndexPath indexPathForRow:row inSection:section]; [self.myview scrollToRowAtIndexPath:loc atScrollPosition:UITableViewScrollPositionBottom animated:YES]; `

在ViewController中创build多个UICollectionView

标题是我的问题。 我在for loop创build了UICollectionView 。 所以,它创build了一些UICollectionView 我的代码: for (int i = 0; i < getAllCategory.count; i ++) { CGRect frame; frame.origin.x = self.scroll.frame.size.width * i; frame.origin.y = 0; frame.size = self.scroll.frame.size; UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init]; collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(screenWidth*i,5,screenWidth ,self.scroll.frame.size.height-5) collectionViewLayout:layout]; [collectionView setDataSource:self]; [collectionView setDelegate:self]; [collectionView setPagingEnabled:YES]; collectionView.showsHorizontalScrollIndicator = NO; collectionView.showsVerticalScrollIndicator = NO; [collectionView registerClass:[UICollectionViewCell […]

如何select另一个表行时将自定义图标删除到UITableViewCellAccessoryCheckmark

我正在使用以下代码将自定义图标添加到UITableViewCellAccessoryCheckmark。 问题在于单元格复选标记不会在另一行被触摸/select时取消select 这是我的代码: – (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { int index = indexPath.row; id obj = [listOfItems objectAtIndex:index]; //This toggles the checkmark UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; if (cell.accessoryType == UITableViewCellAccessoryNone) { cell.accessoryType = UITableViewCellAccessoryCheckmark; UIImage *image = [UIImage imageNamed:@"icon-tick.png"]; UIButton *downloadButton = [UIButton buttonWithType:UIButtonTypeCustom]; [downloadButton setImage:image forState:UIControlStateNormal]; [downloadButton setFrame:CGRectMake(0, 0, 19, 19)]; [downloadButton setBackgroundColor:[UIColor […]

在UITableView和GoogleMap的视图上开始触摸时closures键盘

我的项目devise: UINavigationController —> UITableViewController —> UIViewController 我在UISeachBar上有一个UISeachBar 我试图使用UITapGestureRecognizer ,它的工作原理,但不是预期的。 当我触摸一个UITableViewCell时,键盘只会解散。 我想让UITableView响应touchesBegan这样我就可以在每次触摸UITableViewCell时使键盘消失,或者只是在表格上滚动。 除此之外,我的UIViewController包含一个googlemap的视图,它确实响应了touchesBegan但只有一个第一个触摸,之后,其他所有触摸都将被忽略。 任何人都可以帮忙吗? 太长了,没有阅读:我想解雇UITableView的虚拟键盘喜欢Safari或铬:当触摸开始,而不是当它结束