我正在开发一个应用程序,我想要更改UIPageControl
分页点的颜色或图像.我该怎么改变它?是否可以UIpageControl
在上述场景中进行自定义?
关于如何使用UIPageViewController实现应用程序的AppCoda本教程,我想在页面顶部而不是底部使用自定义页面控制元素.
当我只是将页面控制元素放在将要显示的单个视图的顶部时,逻辑结果是控件元素滚动,页面视图远离屏幕.
如何将控制元素置于视图顶部以使页面视图全屏(如图像),以便用户可以在固定控件元素下看到视图?
我附上了一个示例屏幕截图 - 来自AppCoda和Path的信用:
我想做一件非常简单的事情.只需删除所有点,以及UIPageViewController底部的栏.
这是设置:我有一个自定义视图控制器,它有UIPageViewController*pageController我显示如下:
self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
self.pageController.dataSource = self;
[[self.pageController view] setFrame:[self.view bounds]];
BSItemPageViewController *initialViewController = [self viewControllerAtIndex:selectedIndex];
NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];
[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:self.pageController];
[[self view] addSubview:[self.pageController view]];
[self.pageController didMoveToParentViewController:self];
Run Code Online (Sandbox Code Playgroud)
关于如何删除点的任何想法?
我正在我的应用程序中制作一个简单的幻灯片视图.我想将我的UIPageControl链接到我的UIScrollView.这应该不会太难,但我无法在任何地方找到一个简单的解决方案.以下是我的代码.
HelpViewController.h
#import <UIKit/UIKit.h>
@interface HelpViewController : UIViewController{
}
@end
Run Code Online (Sandbox Code Playgroud)
HelpViewController.m
#import "HelpViewController.h"
@interface HelpViewController ()
@end
@implementation HelpViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect scrollViewFrame = CGRectMake(0, 62, 320, 404);
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:scrollViewFrame];
[self.view addSubview:scrollView];
CGSize scrollViewContentSize = CGSizeMake(640, 404);
[scrollView setContentSize:scrollViewContentSize];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(200, 200, 50, 21)];
[label setText:@"Hello"];
[scrollView addSubview:label]; …
Run Code Online (Sandbox Code Playgroud) 我正在制作一个应用程序,使用页面控件可以滚动10个图像.问题是我完全不知道如何使用页面控件.任何帮助都表示赞赏.
我正在尝试创建一个具有多个视图的页面视图控制器.我想要一个使用UIPageViewController的简单代码示例.
在这里,我有一个页面控件,它工作正常,但点击它不会改变页面,所以请帮助改变页面的功能:
- (void)viewDidLoad {
scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 420)];
scrollView.delegate = self;
[self.scrollView setBackgroundColor:[UIColor whiteColor]];
[scrollView setCanCancelContentTouches:NO];
scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
scrollView.clipsToBounds = YES;
scrollView.scrollEnabled = YES;
[scrollView setShowsHorizontalScrollIndicator:NO];
scrollView.pagingEnabled = YES;
[self.view addSubview:scrollView];
pageControl=[[UIPageControl alloc]initWithFrame:CGRectMake(0, 420, 320, 40)];
[pageControl addTarget:self action:@selector(changepage:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:pageControl];
UIView *blueView = [[UIView alloc] init];
blueView.frame = CGRectMake(0, 0, 640, 480);
blueView.backgroundColor = [UIColor whiteColor];
[scrollView addSubview:blueView];
self.pageControl.numberOfPages = 2;
[scrollView setContentSize:CGSizeMake(640, 0)];
}
-(void)changepage:(id)sender
{
int page = pageControl.currentPage;
if (page < 0)
return; …
Run Code Online (Sandbox Code Playgroud) 我是iphone编程的新手,我正在尝试开发一个使用页面控件的应用程序.我的视图背景颜色为白色,页面控制器默认为白色,这使得页面控件在我的视图中不可见,因此我更改了页面控件的背景颜色使其可见.现在,该视图显示已修补且不良.有没有办法改变页面控制的点颜色?
提前致谢
如何以编程方式导航到特定页面.基本上我有一个带有scrollView的应用程序,其中填充了一堆子视图(在本例中为tableViews).当点击子视图时,它会放大并且用户可以编辑和导航表格,但是当我缩小时,我会重新加载整个视图,以防用户做出任何更改.当然重新加载视图会将用户发送回第0页.我已经尝试设置pageControl.currentpage属性,但所有这一切都改变了pageControl的点.这是否意味着某些事情是错误的,还是我还需要做其他事情?
所有控制页面滚动的方法都是这种方法:
- (void)scrollViewDidScroll:(UIScrollView *)sender
{
CGFloat pageWidth = self.scrollView.frame.size.width;
int page = floor((self.scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
self.pageControl.currentPage = page;
NSString *listName = [self.wishLists objectAtIndex:self.pageControl.currentPage];
self.labelListName.text = listName;
}
Run Code Online (Sandbox Code Playgroud) 你好我有UICollectionView
水平图像列表代码,我想PageControl
在滚动图像显示时添加,我添加了pagecontrol选择器,IBOutlet
但是,我如何整合它?之间UICollecitonView
.?
我的代码如下.
class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
@IBOutlet weak var View : DesignableView!
@IBOutlet var collectionView: UICollectionView!
@IBOutlet var collectionViewLayout: UICollectionViewFlowLayout!
@IBOutlet open weak var pageControl: UIPageControl? {
didSet {
pageControl?.addTarget(self, action: #selector(ViewController.pageChanged(_:)), for: .valueChanged)
}
}
override func viewDidLoad() {
super.viewDidLoad()
pageControl?.numberOfPages = 11
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 11;
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let …
Run Code Online (Sandbox Code Playgroud) uipagecontrol ×10
ios ×7
iphone ×5
uiscrollview ×4
swift ×2
cocoa-touch ×1
colors ×1
image ×1
ios7 ×1
objective-c ×1
pagination ×1
storyboard ×1
swift3 ×1
xcode ×1