尝试推视图控制器时,我收到此错误.
我有一个从桌面连接的segue,
pushViewController:animated:在现有转换或演示文稿发生时调用;导航堆栈将不会被更新.
class PlaylistsViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate {
let ItemRecordName = "Playlists"
var playlists = NSMutableArray()
@IBOutlet var tableView: UITableView?
var cloudm = CloudManager()
var container: CKContainer?
var publicDatabase: CKDatabase?
var edgePan = UIScreenEdgePanGestureRecognizer()



override func viewDidLoad() {
    super.viewDidLoad()


    self.setUpMenu()
    container = CKContainer.defaultContainer()
    publicDatabase = container?.privateCloudDatabase

    self.tableView!.contentInset = UIEdgeInsetsMake(64,0)

}
func setUpMenu() {

    self.slidingViewController().topViewAnchoredGesture = EcslidingViewControllerAnchoredGesture.Panning |  EcslidingViewControllerAnchoredGesture.Tapping

    //self.navigationController.view.addGestureRecognizer(self.slidingViewController().panGesture)
    edgePan = UIScreenEdgePanGestureRecognizer(target: self,action: "menuButtonTapped")
   edgePan.edges = UIRectEdge.Left
    edgePan.delegate = self
    self.navigationController.view.addGestureRecognizer(edgePan)


    self.navigationController.navigationBar.translucent = true

    let icon = FAKIonIcons.naviconIconWithSize(40)
    icon.addAttribute(NSForegroundColorAttributeName,value: UIColor.whiteColor())
    let iconImage = icon.imageWithSize(CGSizeMake(40,40))

    let plusicon = FAKIonIcons.ios7PlusEmptyIconWithSize(30)
    plusicon.addAttribute(NSForegroundColorAttributeName,value: UIColor.whiteColor())
    let plusiconImage = plusicon.imageWithSize(CGSizeMake(30,30))

    let barButton = UIBarButtonItem(image: iconImage,style: UIBarButtonItemStyle.Plain,target: self,action: "menuButtonTapped")
    let barButton2 = UIBarButtonItem(image: plusiconImage,action: "openNameForPlaylist")
    barButton2.tag = 1
    let negativeSpacer = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Fixedspace,target: nil,action: nil)
    let negativeSpacer2 = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Fixedspace,action: nil)
    negativeSpacer.width = -10
    negativeSpacer2.width = 0.0

    self.navigationItem.leftBarButtonItems = NSArray(objects: negativeSpacer,barButton)
    self.navigationItem.rightBarButtonItems = NSArray(objects: negativeSpacer2,barButton2)

}
override func viewDidAppear(animated: Bool)  {
    self.getPlaylists()
}
func menuButtonTapped () {
    self.slidingViewController().anchorTopViewToRightAnimated(true)
}
func getPlaylists() {
    cloudm.fetchPlaylistNames("Playlists",completionHandler: {(records: NSMutableArray) -> Void in
        if records.count > 0 {
            println("got Playlists")
            self.playlists = records
            self.tableView?.reloadData()
            //self.noFoodLabelAlpa(0,withDuration: 0,withDelay: 0)


        } else {
            println("dont got Playlists")
            //self.noFoodLabelAlpa(1,withDuration: 1,withDelay: 1.8)
        }
        })

}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // dispose of any resources that can be recreated.
}
func openNameForPlaylist() {
     var alert = UIAlertView(title: "Playlist Name",message: "Please choose a name for your Playlist",delegate: self,cancelButtonTitle: "Done")
    alert.alertViewStyle = UIAlertViewStyle.PlainTextInput
    alert.show()
}
func alertView(alertView:UIAlertView,clickedButtonAtIndex buttonIndex: NSInteger){
println(alertView.textFieldAtIndex(0).text)
    addplaylist(alertView.textFieldAtIndex(0).text)
}
func addplaylist(name: String) {
    if playlists.count == 10 {
        var alert = UIAlertView(title: "Playlist is full",message: "You've reached the maximum number of songs in your playlist,to add more please remove some",cancelButtonTitle: "ok")
        alert.show()
    } else {
        println("playlist count = \(self.playlists.count)")
        var newRecord: CKRecord = CKRecord(recordtype: ItemRecordName)
        //var playlistName = "Playlist \(self.playlists.count + 1)"
        newRecord.setobject(name,forKey: "playlistName")
        self.cloudm.saveRecord(newRecord)

        self.playlists.insertObject(newRecord,atIndex: 0)
        //self.playlists.addobject(newRecord)
        self.playlists.sortUsingDescriptors([NSSortDescriptor(key: "playlistName",ascending: true)])
        var indexPath = NSIndexPath(forRow: 0,inSection: 0)
        self.tableView?.insertRowsAtIndexPaths([indexPath],withRowAnimation: UITableViewRowAnimation.Automatic)


    }
}
func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
    return 1;
}
func tableView(tableView: UITableView!,heightForHeaderInSection section: Int) -> Int {
    return 1
}
func tableView(tableView: UITableView!,viewForFooterInSection section: Int) -> UIView {
    var view = UIView(frame: CGRect.zeroRect)
    return view
}


func tableView(tableView: UITableView!,heightForFootInSection section: Int) -> Int {
    return 1
}

func tableView(tableView: UITableView!,numberOfRowsInSection section: Int) -> Int {
    return playlists.count
}

func tableView(tableView: UITableView!,cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!  {
    let CellIndentifier: Nsstring = "playlistCell"

    var cell : UITableViewCell  = tableView.dequeueReusableCellWithIdentifier(CellIndentifier) as UITableViewCell
    var selectedView = UIView(frame: CGRectMake(0,cell.contentView.frame.size.width,cell.contentView.frame.size.height))
    cell.selectedBackgroundView = selectedView


    cell.backgroundColor = UIColor.clearColor()


    var records: CKRecord = self.playlists[indexPath.row] as CKRecord
    var playlist:String = records.objectForKey("playlistName") as String
    println("Playlists are \(playlist)")

    cell.textLabel.text = playlist


    return cell
}
func tableView(tableView: UITableView?,canEditRowAtIndexPath indexPath: NSIndexPath?) -> Bool {
    // Return NO if you do not want the specified item to be editable.
    return true
}

func tableView(tableView: UITableView!,commitEditingStyle editingStyle: UITableViewCellEditingStyle,forRowAtIndexPath indexPath: NSIndexPath!) {
    if editingStyle == .Delete {
        // Delete the row from the data source
        self.cloudm.deleteRecord(self.playlists[indexPath.row] as CKRecord)
        self.playlists.removeObjectAtIndex(indexPath.row)
        tableView.deleteRowsAtIndexPaths([indexPath],withRowAnimation: .Fade)
    }
}

func tableView(tableView: UITableView!,didEndEditingRowAtIndexPath indexPath: NSIndexPath!) {
    if playlists.count > 0 {
        //self.noFoodLabelAlpa(0,withDelay: 0)

    } else {
        //self.noFoodLabelAlpa(1,withDelay: 0)
    }
}
override func prepareForSegue(segue: UIStoryboardSegue!,sender: AnyObject!)  {
    var indexPath = self.tableView!.indexPathForSelectedRow()
    var record: CKRecord = self.playlists[indexPath.row] as CKRecord
    let playlistOpen: PlaylistsOpenViewController = segue.destinationViewController as PlaylistsOpenViewController
    playlistOpen.parentRecordID = record.recordID.recordName
    playlistOpen.cloudm = self.cloudm

}

}

更新:
好的,所以我已经安装了xcode beta 5,现在模拟器和我的手机都收到这个错误,这在这个版本之前不存在任何想法?

解决方法

这似乎是您正在使用的EcslidingView中的错误.看到他们的 issue tracker.有一个解决方法,有助于一些情况,但它不会帮助你在这里恐怕.我们现在可以做的就是等待一个补丁,或者让苹果在Beta 5中打破他们所打破的一切.

我决定把所有的Ecsliding都抛出窗外,重新开始使用SWRevealViewController.这个开关令人惊讶的是没有痛苦,把大约一个小时的工作花了一个约20K LOC的应用程序.这是我建议任何人遇到这个问题.

现在有一个修复合并到主分支.我会在这里发布,以供参考,它由SpruceGoose429提供,并附加于fcy Github上:

In EcslidingViewController.m replace the following code:

- (id<UIViewControllerTransitionCoordinator>)transitionCoordinator {
    return self;
}

With this block:

- (id<UIViewControllerTransitionCoordinator>)transitionCoordinator
{
    // Return self if a transition is in progress (we're the transition coordinator).
    // Otherwise,defer to super.
    return ((_transitionInProgress)? self: [super transitionCoordinator]);
}

正如我所提到的那样,修复程序是EcslidingViewController的2.0.3版本.

ios – 推视图:当现有的转换或演示正在发生时;导航堆栈将不会被更新的更多相关文章

  1. ios – UITableView和Cell Reuse

    这是我的CustomCell类的init方法解决方法如果没有要显示的图像,则必须清除图像视图:

  2. ios – fetchedResultsController.fetchedObjects.count = 0但它充满了对象

    我正在使用相当标准的fetchedResultsController实现来输出tableView.在-viewDidLoad的最后,我正在进行第一次调用:这是我的fetchedResultsController:我的tableView方法:所以,问题是:在_fetchedResultsController.fetchedobjects.count的日志中等于0,但在视觉上tableView充满了对

  3. ios – UITableView在滚动时阻止重新加载

    或者你能想象一个防止这种行为的好方法吗?解决方法抱歉,我没有足够的声誉来添加评论,因此在单独的答案中回答您的上一个问题.-performSelector:withObject:afterDelay:延迟为0.0秒不会立即执行给定的选择器,而是在当前的RunloopCycle结束后和给定的延迟之后执行它.-performSelector:withObject:添加到当前Runloop循环中并执行.这与直接调用该方法相同.因此,使用-performSelector:withObject:afterDelay:

  4. ios – 在Swift中通过标记访问UITableViewCell内部的不同视图

    我正在尝试使用swift为iOS8制作应用程序.这里的目标是制作一种新闻源.此Feed显示来自用户的帖子,其遵循特定模式.我想过使用UITableView,其中每个单元格都遵循自定义布局.当我尝试访问其中的文本标签时出现问题.我尝试通过它的标签访问它,但是当我这样做时,整个应用程序崩溃了.报告的错误是“Swift动态转换失败”,我使用以下代码访问视图:难道我做错了什么?解决方法我认为问题是标签0.所有视图都是默认值0.所以尝试另一个标签值.

  5. ios – 如何实现`prepareForReuse`?

    解决方法尝试将此添加到您的MGSwipeTableCell.m:

  6. ios – 在UITableView上轻扫以删除以使用UIPanGestureRecognizer

    我使用以下代码将UIPanGuestureRecognizer添加到整个视图中:在主视图中我有一个UITableView,它有这个代码来启用滑动删除功能:只有RUNNING1打印到日志中,并且“删除”按钮不会显示.我相信其原因是UIPanGestureRecognizer,但我不确定.如果这是正确的,我该如何解决这个问题.如果这不正确,请提供原因并解决.谢谢.解决方法从document:Ifage

  7. viewWillAppear vs Viewdidload ios

    使用iOS导航应用程序的代码时,我遇到了麻烦:我在哪里可以为UITableView设置方法“initdata”?请帮帮我.解决方法您可以根据应用程序的需求放置initData,如果您的表需要每次使用新数据加载数据,那么它应该在否则,如果表需要通过单个数据重新加载,该数据不会发生变化或者没有对数据执行任何编辑操作,则应使用

  8. xcode – 如何在LLDB断点条件下使用堆栈内容?

    问题:我有一种情况,我们在发布期间有媒体播放,并且objc_exception_throw()在此期间大约有5次点击,但总是被捕获,并且它在媒体播放器对象的南边.我厌倦了(a)必须手动连续n次,或者(b)在播放完成之前必须禁用断点.我尝试过的:>使断点忽略前五次命中(问题:它并不总是正好五次)>使用我的目标作为模块创建我自己的符号断点(问题:没有改变)我想做什么:想到的一个解决方案是在断点命中时评

  9. ios tableView reloadRowsAtIndexPaths无效

    解决方法包裹它怎么样?希望这可以帮助.

  10. ios – 我的表视图在滚动时在SWIFT中重用所选单元格

    实例变量

随机推荐

  1. iOS实现拖拽View跟随手指浮动效果

    这篇文章主要为大家详细介绍了iOS实现拖拽View跟随手指浮动,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

  2. iOS – genstrings:无法连接到输出目录en.lproj

    使用我桌面上的项目文件夹,我启动终端输入:cd然后将我的项目文件夹拖到终端,它给了我路径.然后我将这行代码粘贴到终端中找.-name*.m|xargsgenstrings-oen.lproj我在终端中收到此错误消息:genstrings:无法连接到输出目录en.lproj它多次打印这行,然后说我的项目是一个目录的路径?没有.strings文件.对我做错了什么的想法?

  3. iOS 7 UIButtonBarItem图像没有色调

    如何确保按钮图标采用全局色调?解决方法只是想将其转换为根注释,以便为“回答”复选标记提供更好的上下文,并提供更好的格式.我能想出这个!

  4. ios – 在自定义相机层的AVFoundation中自动对焦和自动曝光

    为AVFoundation定制图层相机创建精确的自动对焦和曝光的最佳方法是什么?

  5. ios – Xcode找不到Alamofire,错误:没有这样的模块’Alamofire’

    我正在尝试按照github(https://github.com/Alamofire/Alamofire#cocoapods)指令将Alamofire包含在我的Swift项目中.我创建了一个新项目,导航到项目目录并运行此命令sudogeminstallcocoapods.然后我面临以下错误:搜索后我设法通过运行此命令安装cocoapodssudogeminstall-n/usr/local/bin

  6. ios – 在没有iPhone6s或更新的情况下测试ARKit

    我在决定下载Xcode9之前.我想玩新的框架–ARKit.我知道要用ARKit运行app我需要一个带有A9芯片或更新版本的设备.不幸的是我有一个较旧的.我的问题是已经下载了新Xcode的人.在我的情况下有可能运行ARKit应用程序吗?那个或其他任何模拟器?任何想法或我将不得不购买新设备?解决方法任何iOS11设备都可以使用ARKit,但是具有高质量AR体验的全球跟踪功能需要使用A9或更高版本处理器的设备.使用iOS11测试版更新您的设备是必要的.

  7. 将iOS应用移植到Android

    我们制作了一个具有2000个目标c类的退出大型iOS应用程序.我想知道有一个最佳实践指南将其移植到Android?此外,由于我们的应用程序大量使用UINavigation和UIView控制器,我想知道在Android上有类似的模型和实现.谢谢到目前为止,guenter解决方法老实说,我认为你正在计划的只是制作难以维护的糟糕代码.我意识到这听起来像很多工作,但从长远来看它会更容易,我只是将应用程序的概念“移植”到android并从头开始编写.

  8. ios – 在Swift中覆盖Objective C类方法

    我是Swift的初学者,我正在尝试在Swift项目中使用JSONModel.我想从JSONModel覆盖方法keyMapper,但我没有找到如何覆盖模型类中的Objective-C类方法.该方法的签名是:我怎样才能做到这一点?解决方法您可以像覆盖实例方法一样执行此操作,但使用class关键字除外:

  9. ios – 在WKWebView中获取链接URL

    我想在WKWebView中获取tapped链接的url.链接采用自定义格式,可触发应用中的某些操作.例如HTTP://我的网站/帮助#深层链接对讲.我这样使用KVO:这在第一次点击链接时效果很好.但是,如果我连续两次点击相同的链接,它将不报告链接点击.是否有解决方法来解决这个问题,以便我可以检测每个点击并获取链接?任何关于这个的指针都会很棒!解决方法像这样更改addobserver在observeValue函数中,您可以获得两个值

  10. ios – 在Swift的UIView中找到UILabel

    我正在尝试在我的UIViewControllers的超级视图中找到我的UILabels.这是我的代码:这是在Objective-C中推荐的方式,但是在Swift中我只得到UIViews和CALayer.我肯定在提供给这个方法的视图中有UILabel.我错过了什么?我的UIViewController中的调用:解决方法使用函数式编程概念可以更轻松地实现这一目标.

返回
顶部