标签: uiscrollview

如何将按钮和图像放在UIScrollView中

我在xcode 4中制作一个ios应用程序,需要制作一个UIScrollView包含按钮和a的应用程序UIImageView.有谁知道如何编码?

(如果可能的话,我更愿意在故事板中这样做)

谢谢

uibutton uiscrollview uiimageview ios

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

动画滚动视图高度 - 内容在动画之前突然跳起

以下是正在发生的事情的截图.

绿色背景是滚动视图中的视图(即标记"内容大小"和"内容偏移").

橙色是滚动视图框架.

键盘已启动...滚动视图可以很好地滚动内容.

在此输入图像描述

现在我点击文本字段,键盘开始隐藏

在此输入图像描述

虽然滚动视图(橙色)似乎是正确的高度,但内容现在已经上升了约100px(绿色).

我不知道造成这种情况的原因是 - 它是一个ios bug还是什么(它也发生在我的设备上).

这是根据键盘显示/隐藏的时间调整视图大小的代码.

- (void)keyboardWillShow:(NSNotification *)notif {
    [self.mainScrollView setAutoresizesSubviews:NO];
    // get the scroll view frame size
    CGRect frame = [self.mainScrollView frame];
    frame.size.height = self.view.frame.size.height-216;

    [UIView beginAnimations:@"scrollViewAnimations" context:nil];
    [UIView setAnimationDuration:0.3];
    [self.mainScrollView setFrame:frame];
    [UIView commitAnimations];

    // add tap gesture recognizer
    _tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_dismissKeyboard:)];
    [_tap setDelegate:self];
    [self.view addGestureRecognizer:_tap];
}

- (void)keyboardWillHide:(NSNotification *)notif {
    CGRect frame = [self.mainScrollView frame];
    frame.size.height = self.view.frame.size.height;

    [UIView beginAnimations:@"scrollViewAnimations" context:nil];
    [UIView setAnimationDuration:0.3];
    [self.mainScrollView setFrame:frame];
    [UIView commitAnimations];

    [self.view removeGestureRecognizer:_tap]; …
Run Code Online (Sandbox Code Playgroud)

animation uiscrollview ios

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

ScrollView还是CollectionView?

我有一个集合视图,填充了以下数据:

[self.graniteImages addObject:[[NSMutableDictionary alloc]
                               initWithObjectsAndKeys:@"Angel Cream", @"name",
                               @"angel-cream.jpg", @"image", nil]];
[self.graniteImages addObject:[[NSMutableDictionary alloc]
                               initWithObjectsAndKeys:@"Angola Black", @"name" ,
                               @"angola_black1.jpg", @"image" , nil]];
Run Code Online (Sandbox Code Playgroud)

然后有一个segue到一个静态的细节视图.

我现在想要在细节视图中添加分页,这样我就可以像在iPhone照片库中那样浏览我在集合视图中包含的图像.

我猜想要么是滚动视图还是第二次收集视图,但我不知道从哪里开始,所以任何指针,示例代码或任何其他帮助你们都可以给予大力赞赏.

谢谢

uiscrollview ios uicollectionview

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

UITcrollView中的UIScrollView不滚动

以下问题:我有一个带有几个单元格的UITableView.该表还有一个标题,我在其中添加了一个UIScrollView,它应该水平滚动.

所以现在当我在屏幕上滚动时,表格将始终滚动,但不会在标题中滚动UIScrollView,即使我在标题区域中滚动水平.

因此,似乎桌子正在管理所有滚动.如何设置UITableView滚动,以便标题中的UIScrollView处理标题区域的水平滚动.

我试图设置UIScrollView的委托并尝试UIScrollViewDelegate中的函数, - (void)scrollViewDidScroll:(UIScrollView*)scrollView,但只有表调用此函数.

我希望你能帮助我.

scroll uitableview uiscrollview ios

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

如何知道用户在屏幕上触摸的视图

如果在uiscrollview上有uiscrollview和多个子视图.如何知道用户触摸的位置,即特定视图或滚动视图(空白区域)

touch uiscrollview ios

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

使用Tabbar的iOS7自动布局结合UIScrollView和zoomable UIImageView无法正常工作

我有一个有点复杂的设置,我有一个可缩放UIImageViewUIScrollView.缩放以及与其相关的所有内容均可正常工作.但是由于在iOS6/7中实现了autoLayout,我似乎无法找到让约束占用的方法UITabBar.因此,现在图像在底部被截断,如下图所示: tabbar问题的图像

在哪里我希望它显示如下: 正确的tabbar图像

到目前为止,我一直在搞乱所有约束,甚至考虑转储AutoLayout,只是为了稍后找到布局的其他问题.

所以我想使用AutoLayout功能,但不知道如何正确使用它们.为了确保缩放部分正常工作,我现在有这样的约束设置: scrollView约束的图像 imageView约束的图像

(ScrollView向左,ImageView右)

希望有人可以指出我正确的方向,如何添加/修改约束,以便TabBar尊重和UIImageView正确显示.

objective-c uiscrollview uiimageview ios ios7

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

iOS为什么不能从UITapGestureRecognizer调用方法collectionView:didSelectItemAtIndexPath?

我在UICollectionView中为UIScrollView设置了一个UITapGestureRecognizer.我已将其配置为正确检测点击并触发我编写的方法,但如果我尝试将选择器设置为collectionView:didSelectItemAtIndexPath:程序在点击单元格时崩溃.

知道为什么会这样吗?

这有效:

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];

- (void) tapped:(UIGestureRecognizer *)gesture{
//some code
}
Run Code Online (Sandbox Code Playgroud)

这不起作用:

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(collectionView:didSelectItemAtIndexPath:)];

- (void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
//some code
}
Run Code Online (Sandbox Code Playgroud)

objective-c uiscrollview ios uitapgesturerecognizer uicollectionview

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

UITableVIewCell中的UIScrollView不会滚动

我有一个UITableView滚动禁用.

在一个UITableViewCell,我有一个UIScrollView.

UITableViewCell子类中,我实现了:

-(void)layoutSubviews
{    
    [mainScrollView addSubview:mainContentView];
    mainScrollView.contentSize = mainContentView.bounds.size;
    mainScrollView.scrollEnabled = YES;
}
Run Code Online (Sandbox Code Playgroud)

调用此方法并正确设置内容大小.

但是UIScrollView不会滚动......你可能会形成它UITableView吗?我已经在其他应用程序中使用a UICollectionView中完成了同样的操作UITableView,但它运行良好.

uitableview uiscrollview ios

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

UIPageControl + circular (Infinite) scrolling

I am working on app in which i have to make welcome screen. In that UIPageControl i need to display different 9 subviews. Also need infinite circular scrolling in that. It means after page-9 if i slide than page-1 should appear.

I have tried so much to implement it but never got expected results.

Can anyone help me out to get the best solution for it.

Thanks.

iphone objective-c uiscrollview uipagecontrol ios

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

如何从子类UITableViewCell调用didSelectRowAtIndexPath

我有一个UITableView,我用来显示数据,要求我有一个比iPhone screenWidth宽得多的单元格.

因此我创建了一个包含子类UIScrollView的子类UITableViewCell.这就是我的代码.

TableView.h

@property (strong, nonatomic) CustomCell *cell;
Run Code Online (Sandbox Code Playgroud)

TableView.m

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    cellDictionary = [xmlMArray objectAtIndex:indexPath.row];
    static NSString *CellIdentifier = @"Cell";

    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    // Configure the cell.
    cell.selectionStyle = UITableViewCellSelectionStyleGray;

    cell.itemsDictionary = cellDictionary;
    cell.currentIndex = indexPath;

    cellDictionary = nil;
    [cell drawCell];

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

在上面的方法中,您可以看到我正在调用我创建的自定义UITableViewCell.

CustomCell.h

@property (strong, nonatomic) NSDictionary *itemsDictionary;
@property (strong, nonatomic) MyScrollView *scrollCell;
@property (strong, nonatomic) NSIndexPath *currentIndex; …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uiscrollview ios

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