嗨,大家好我有4个错误;
var tar = 1;
var slideInterval;
function slide(){
switch(tar){
case 1:
jQuery("#um1").toggle(300, function(){jQuery("#um2").toggle(300);});
tar=2;
break;
case 2:
jQuery("#um2").toggle(300, function(){jQuery("#um3").toggle(300);});
tar=3;
break;
case 3:
jQuery("#um3").toggle(300, function(){jQuery("#um1").toggle(300);});
tar=1;
break;
}
}
jQuery(function(){
jQuery("#logosect").mouseenter(function(){
clearInterval( slideInterval );
}).mouseleave(function(){
slideInterval = window.setInterval(slide, 5000);
}).trigger("mouseleave");
});
这是错误消息的第一个错误:Expected','separator
import UIKit
class ViewController: UIViewController, UIPageViewControllerDataSource{ // error1: Expected ',' separator
这是错误消息的第二个错误:无法将类型'ViewController'的值分配给'UIPageViewControllerDataSource'类型的值?
//For Navigation Bar Tint and BG Color
var NavBarBGColor = CommonUtilities.RGBColor("#2574A9")
var NavBarTintColor = UIColor.whiteColor()
var pageViewController: UIPageViewController!
var pageTitles: NSArray!
var pageImages: NSArray!
@IBOutlet weak var Open: UIBarButtonItem!
override func viewDidLoad() {
//Navigation Bar Tint and BG Color
self.navigationController?.navigationBar.tintColor = NavBarTintColor
self.navigationController?.navigationBar.barTintColor = NavBarBGColor
super.viewDidLoad()
//Menu Button Click
Open.target = self.revealViewController()
Open.action = Selector("revealToggle:")
//Pan Gesture Recognizer for page navigation
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
//Page View Controller for Men
self.pageTitles = NSArray(objects: "Try","And")
self.pageImages = NSArray(objects: "dummying - men","dummying - women")
self.pageViewController = self.storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as! UIPageViewController
self.pageViewController.dataSource = self //error2: Cannot assign a value of type 'ViewController' to a value of type 'UIPageViewControllerDataSource?'
这是错误消息的第二个错误:使用未解析的标识符'Forward'
var startVC = self.viewControllerAtIndex(0) as ContentMenuViewController
var viewControllers = NSArray(object: startVC)
self.pageViewController.setViewControllers(viewControllers, direction: Forward animated: true, completion: nil) //error2: Use of unresolved identifier 'Forward'
这是错误消息的第二个错误:运算符后的预期表达式 { 返回零 } return self.viewControllerAtIndex(index) }
self.pageViewController.view.frame = CGRectMake(0, 30, self.view.frame.width, self.view.frame.size.height - 60)
self.addChildViewController(self.pageViewController)
self.view.addSubview(self.pageViewController.view)
self.pageViewController.didMoveToParentViewController(self)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func MenuRestartBtn(sender: AnyObject) {
}
func viewControllerAtIndex(index: Int) -> ContentMenuViewController
{
if ((self.pageTitles.count == 0)) || (index >= self.pageTitles.count)
{
return ContentMenuViewController()
}
var vc: ContentMenuViewController = self.storyboard?.instantiateViewControllerWithIdentifier("") as! ContentMenuViewController
vc.imageFile = self.pageImages[index] as! String
vc.titleText = self.pageTitles[index] as! String
vc.pageIndex = index
return vc
}
//Page View Controller Data Source
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) ->UIViewController?
{
var vc = viewController as! ContentMenuViewController
var index = vc.pageIndex as Int
if (index == 0 || index == NSNotFound)
{
return nil
}
index--
return self.viewControllerAtIndex(index)
}
func pageViewController(pageController: UIPageViewController, ViewControllerAfterViewController viewController: UIViewController) -> UIViewController?{
var vc = viewController as! ContentMenuViewController
var index = vc.pageIndex as Int
if (index == NSNotFound){
return nil
}
index ++
if (index == self.pageTitles.count)//error3: Expected expression after operator
感谢帮助人员..
答案 0 :(得分:0)
修改强>
嗯,第二个错误是因为第一个错误。第一个错误毫无意义,我建议您Product -> Clean
。
还有其他两个错误,请尝试以这种方式编写.Forward
(该转发必须在枚举中,我希望您的代码中有某处未发布)。