Tag: uiscrollview

如果以编程方式创build,则无法访问UIImageView

如果我通过Storyboard创build一个UIImageView并将其作为@property添加到ViewController.h ,则可以通过[self UIImageView]或self.UIImageView从ViewController.m任何位置访问该UIImageView 。 但是,如果我从viewDidLoad以编程方式创buildUIImageView ,如下所示,我似乎失去了从viewDidLoad外部访问它的能力。 UIImageView *prevImgView = [[UIImageView alloc] init]; UIImageView *currImgView = [[UIImageView alloc] init]; UIImageView *nextImgView = [[UIImageView alloc] init]; NSArray *imageViews = [NSArray arrayWithObjects:prevImgView, currImgView, nextImgView, nil]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds]; [self.view addSubview: scrollView]; CGRect cRect = scrollView.bounds; UIImageView *cView; for (int i=0; i<imageViews.count; i++) { cView = […]

如何在故事板中devise一个UIScrollView

我有一个UIScrollView内embedded了UIView 。 UIView设置为1000的垂直高度。此外,有一个水平居中的button,并设置为从UIView的底部边缘有20个单位。 一切都按预期工作,但我无法在故事板中devise这种情况。 看下面的截图。 屏幕大小以外的内容不可见 – 如何查看/滚动视图到位 提前致谢。

Swift 2.0,SpriteKit – 滚动查看不使用页面。

好的,我有一个scrollView已经被子类化,可以应用到任何场景,这是从我在这里问: SpriteKit,Swift 2.0 – ScrollView相反 import Foundation import SpriteKit /// Nodes touched var nodesTouched: [AnyObject] = [] // global /// Scroll direction enum ScrollDirection: Int { case None = 0 case Vertical case Horizontal } class CustomScrollView: UIScrollView { // MARK: – Static Properties /// Touches allowed static var disabledTouches = false /// Scroll view […]

ScrollView问题Swift

我有一个内部滚动视图的视图控制器,但是当我加载视图控制器的scrollview视图不是从顶部开始,但几乎在一半的屏幕上,像这样: view controller是在pageviewcontroller但我认为这并不重要。 我不会提供代码,因为我认为它在这种情况下并不重要,但如果我将它发布。 我试图打印contentOffset但我得到(0.0, 0.0) contentOffset (0.0, 0.0)

在UIScrollView中使用Cirrious.FluentLayouts.Touch进行Autolayouts

我必须在scrollView中使用autolayout来做一个ViewController,但是这里有一些问题: public SomeVC() : UIViewController { _mainScrollView = new UIScrollView { ShowsHorizontalScrollIndicator = false, ShowsVerticalScrollIndicator = true, BackgroundColor = UIColor.Clear, ScrollEnabled = true, AutoresizingMask = UIViewAutoresizing.FlexibleHeight, TranslatesAutoresizingMaskIntoConstraints = true }; _userDataTableView = new UITableView(CGRect.Empty, UITableViewStyle.Grouped); _userDataTableView.LayoutIfNeeded(); _saveButton = new UIButton(); _menuTableView = new UITableView(CGRect.Empty, UITableViewStyle.Grouped); _menuTableView.LayoutIfNeeded(); _logoutButton = new UIButton(); } public override void LoadView() […]

有可能使用UIPageControl来控制UITableView的移动吗?

从苹果示例“PageControl”中,我们可以知道UIPageControl可以用来控制滚动视图中页面的移动。 由于UITableView是UIScrollView的子类,我想使用UIPageControl来控制表视图单元格的移动,就像在“PageControl”中一样。 但是找不到代理的任何接口。 问题是: 这是可能的吗? 为什么? 谢谢 让我回答我的问题: 以编程方式select和滚动 清单6-5以编程方式select一行 – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath { NSIndexPath *scrollIndexPath; if (newIndexPath.row + 20 < [timeZoneNames count]) { scrollIndexPath = [NSIndexPath indexPathForRow:newIndexPath.row+20 inSection:newIndexPath.section]; } else { scrollIndexPath = [NSIndexPath indexPathForRow:newIndexPath.row-20 inSection:newIndexPath.section]; } [theTableView selectRowAtIndexPath:scrollIndexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle]; }

SpriteKit,Swift 2.0 – ScrollView相反

我设法得到一个滚动视图工作和滚动,但现在当我去滚动它只滚动从右到左,并想知道如何去扭转它,所以它从左到右滚动。 这是我的菜单代码,其中包含我的滚动视图: var moveableNode = SKNode() var scrollView: CustomScrollView! private var spriteSize = CGSize.zero let kMargin: CGFloat = 40 var sprite = SKSpriteNode() class Menu: SKScene { override func didMoveToView(view: SKView) { addChild(moveableNode) spriteSize = SKSpriteNode (imageNamed: "card_level01").size let initialMargin = size.width/2 let marginPerImage = kMargin + spriteSize.width scrollView = CustomScrollView(frame: CGRect(x: 0, y: 0, […]

UIScrollView不能高度滚动

我有UIScrollView在其中的控制器,并在iPad版本没有滚动从底部。 我明确地设置内容大小高度: CGSize newSize = CGSizeMake(self.view.bounds.size.width-4, 2500); // assume self is the content view CGRect newFrame = (CGRect){CGPointZero,newSize}; // Assuming you want to start at the top-left corner of the scroll view. Change CGPointZero as appropriate [self.mainScroll setContentSize:newSize]; 即使在debugging器,当我打印scrollView描述我看到以下内容: <UIScrollView: 0x7fc12486e400; frame = (0 0; 768 960); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7fc1259cf830>; layer […]

手动滚动显示相同内容的两个UICollectionViews

正如标题所示,我有一个UIViewController与两个UICollectionViews以水平方式显示相同的内容。 主要一次显示一张照片,大拇指显示几张。 我已经重写了UIScrollViewDelegate方法,并添加了一些代码,以便当用户滚动主要的CV,然后拇指CV也滚动。 不过,我想要启用相反的方式(滚动拇指,这将快速移动主)。 不过,我收到了反馈的效果。 这是我的代码片段: #pragma mark – UIScrollViewDelegate – (void)scrollViewDidScroll:(UIScrollView *)scrollView{ if(scrollView == self.mainCollectionView){ CGFloat x = self.mainCollectionView.contentOffset.x / self.mainCollectionView.bounds.size.width * SM_IPHONE_THUMB_CONTAINER_SIZE; // cell width + spacing 48 + 8 CGFloat y = 0; CGPoint contentOffset = CGPointMake(x, y); self.thumbsCollectionView.contentOffset = contentOffset; } else if(scrollView == self.thumbsCollectionView){ // CGFloat x = self.thumbsCollectionView.contentOffset.x / […]

如何用UIScrollView实现UIPageViewController?

我从苹果网站上拿了Photo Scroller的例子,并试图通过复制代码来实现我自己的Album。 现在, UIScrollView不可见。 我如何让它出现? 我唯一的代码更改是在创buildUIPageViewController 。 在我的情况下,这是一个UIViewController打开它,而不是AppDelegate 。 @implementation BasePhotoViewController – (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nil bundle:nibBundleOrNil]; if (self) { // kick things off by making the first page PhotoViewController *pageZero = [PhotoViewController photoViewControllerForPageIndex:0]; if (pageZero != nil) { // assign the first page to the pageViewController (our rootViewController) //UIPageViewController […]