App Delegate - 页面控制器错误

时间:2016-03-10 12:02:26

标签: ios swift

我不确定我在下面的陈述中做错了什么。我已经为我的项目添加了一个页面视图控制器,但是当我构建并运行该项目时,我得到了一个' bool'错误。这是代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)

    let pageControl = UIPageControl.appearance()
    pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
    pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
}

2 个答案:

答案 0 :(得分:1)

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

    UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)

    let pageControl = UIPageControl.appearance()
    pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
    pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
    return true
}

答案 1 :(得分:0)

您尚未返回声明,您需要返回true或false。我想你忘记了return true。请尝试使用以下代码:

    let pageControl = UIPageControl.appearance()
    pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
    pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()

    return true

希望有所帮助!