小编use*_*169的帖子

循环遍历UICollectionView中的所有单元格

我有一个UICollectionView,我想为每个单元格添加动画.

目前我正在使用

for(UICollectionView *cell in collectionView.visibleCells){
  //add animation to cell here
}
Run Code Online (Sandbox Code Playgroud)

但是,这仅将动画应用于可见单元格,并且只要向下滚动并且单元格不再可见,动画就会停止.

我如何循环遍历所有细胞UICollectionView

ios ios6 uicollectionview uicollectionviewcell

12
推荐指数
1
解决办法
2万
查看次数

在4英寸iPhone模拟器中显示错误的高度

我正在使用Xcode 4.6.3,我的故事板看起来像这样, 故事板
当我在任何其他硬件配置(所有尺寸,iPhone和iPad)中运行应用程序时,除4英寸视网膜外,它的效果非常好.它在顶部和底部切断. 在模拟器上运行应用程序
当我在模拟器上按回家时,主屏幕和其余部分看起来正常 主屏幕
我完全不知道是什么导致这种情况,我没有一个具有这种尺寸的实际设备来测试.

iphone xcode ios ios-simulator ios6

5
推荐指数
1
解决办法
2626
查看次数

iOS创建滑动返回

I want to make a back swipe like the one in iOS 7.I'm still new with the whole iOS development, this is what I'm currently using.
Currently I have a pan gesture that detects if the user swipes back and then it just pops the navigation controller.

UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self.view addGestureRecognizer:pan];


-(void)handlePan:(UIPanGestureRecognizer *)sender{
    CGPoint tran = [recognizer translationInView:recognizer.view];
    CGPoint vel = [recognizer velocityInView:recognizer.view];
    if(vel.x > 500 && tran.x > 100){
        [self.navigationController popViewControllerAnimated:YES];
    }
}
Run Code Online (Sandbox Code Playgroud)

I …

uinavigationcontroller ios uiswipegesturerecognizer uipangesturerecognizer ios7

4
推荐指数
1
解决办法
3888
查看次数

iOS简单的SQL bug

我有一个简单的添加页面,它将项目添加到SQLite DB,然后将其显示在UITableview上.

在我将"类别"一词添加到列表中并将其显示在tableview中后,删除功能出现问题.

我的主表名为CATEGORY,因此删除SQL语句是

DELETE FROM ITEMS WHERE CATEGORY = "category"
Run Code Online (Sandbox Code Playgroud)

删除类别项后,它还会删除其他所有内容.

如何防止语句删除所有项目?

sql sqlite iphone uitableview ios

3
推荐指数
1
解决办法
98
查看次数

使用ECSliding切换视图而不使用导航菜单

我正在使用ECSlidingViewController.

在示例项目中,我在第一个视图上添加了一个带有IBAction
的按钮我希望第一个视图上的按钮转到第二个视图(不使用滑出导航).

- (IBAction)btnPressed:(id)sender {
    UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondTop"];
    [self.slidingViewController anchorTopViewOffScreenTo:ECRight animations:nil onComplete:^{
        CGRect frame = self.slidingViewController.topViewController.view.frame;
        self.slidingViewController.topViewController = newTopViewController;
        self.slidingViewController.topViewController.view.frame = frame;
        [self.slidingViewController resetTopView];
    }];
}
Run Code Online (Sandbox Code Playgroud)

使用此代码,它只会转到导航滑出菜单,而不会转到第二个

iphone ios ecslidingviewcontroller

2
推荐指数
1
解决办法
1068
查看次数

iOS重新排序UITableView

我有一个UITableView从sql db读取数据.

当我重新排序数据时,它只会改变顶部和底部数据

在此输入图像描述

从上到下拖动1

在此输入图像描述

当我让它在5时它只切换顶部和底部.

在此输入图像描述 我使用以下内容

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {

            [myStringsArray exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row];

}
Run Code Online (Sandbox Code Playgroud)

我如何重新排序列表?所以它将是2,3,4,5,1而不是5,2,3,4,1

uitableview nsarray ios

1
推荐指数
1
解决办法
956
查看次数