Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 重写故事板中的类或子类_Iphone_Ios_Uipagecontrol_Uistoryboard_Uipageviewcontroller - Fatal编程技术网

Iphone 重写故事板中的类或子类

Iphone 重写故事板中的类或子类,iphone,ios,uipagecontrol,uistoryboard,uipageviewcontroller,Iphone,Ios,Uipagecontrol,Uistoryboard,Uipageviewcontroller,我在脚本中分配自定义类时遇到问题 在过去的项目中,我通过使用UIPageControl将.h添加到视图中,将UIPageControl重写/子类化为自定义类(ZZPageControl) #import "MyPageControl.h" @interface ScrollerVC : UIViewController <UIScrollViewDelegate> { UIScrollView *scrollView; IBOutlet MyPageControl *

我在脚本中分配自定义类时遇到问题

在过去的项目中,我通过使用
UIPageControl
将.h添加到视图中,将
UIPageControl
重写/子类化为自定义类(
ZZPageControl

#import "MyPageControl.h"
@interface ScrollerVC : UIViewController <UIScrollViewDelegate> {
    UIScrollView *scrollView;
    IBOutlet MyPageControl *pageControl;
    NSMutableArray *viewControllers;
    BOOL pageControlUsed;
}
#导入“MyPageControl.h”
@界面ScrollRVC:UIViewController{
UIScrollView*滚动视图;
IBOutlet MyPageControl*页面控制;
NSMutableArray*视图控制器;
使用BOOL-pagecontrol;
}
然后在IB中,我分配自定义类,而不是
UIPageControl

#import "MyPageControl.h"
@interface ScrollerVC : UIViewController <UIScrollViewDelegate> {
    UIScrollView *scrollView;
    IBOutlet MyPageControl *pageControl;
    NSMutableArray *viewControllers;
    BOOL pageControlUsed;
}
除了我的新项目使用故事板,而不是单独的XIB。在视图中选择
UIPageControl
并在Identity Inspector中检查其类时,仅列出
UIPageControl
。如果我键入
MyPageControl
is,则它不会粘住

我已经尝试在app委托中添加
#import“MyPageControl.h”
,在.pch文件中启动
UINavigation
控件的视图中。我无法让自定义类显示在情节提要中


如何在脚本视图中覆盖
UIPageControl

我假设您在
MyPageControl.h
@interface MyPageControl:UIPageControl
中正确地将UIPageControl子类化了?
MyPageControl
是链接类还是直接在您的项目中?@Gobot确实是,正如我提到的,我在以前的项目中使用过它。区别在于情节提要“UIPageControl”是唯一列在标识检查器中的类您是否运行了清理和重建?所有的东西还在编译没有警告?是的。在过去,检查器显示了所有可用的类,故事板只显示了一个类,因此我不能重写。我可以通过编程方式重新分配该类吗?尝试启动一个新的临时项目,将您的
MyPageControl
类拖动到该项目中,然后查看是否可以将其分配给情节提要中的
UIPageControl
。这至少可以告诉我们您的XCode项目是否已损坏,或者您的类中是否出现了问题。