Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVCalendarView disappears #258

Closed
ghost opened this issue Mar 23, 2016 · 2 comments
Closed

CVCalendarView disappears #258

ghost opened this issue Mar 23, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 23, 2016

Xcode 7.2, Swift 2.0. I added two UIViews (with custom classes CVCalendarView and CVCalendarMenuView) as well as required delegates to UIViewController in Storyboard. Here is my code inside the VC:

import UIKit
import CVCalendar

class ViewController: UIViewController, CVCalendarMenuViewDelegate, CVCalendarViewDelegate {

    @IBOutlet weak var menuView: CVCalendarMenuView!
    @IBOutlet weak var calendarView: CVCalendarView!


    override func viewDidLoad() {
        super.viewDidLoad()

    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        calendarView.commitCalendarViewUpdate()
        menuView.commitMenuViewUpdate() 
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func presentationMode() -> CalendarMode {
        return CalendarMode.MonthView
    }

    func firstWeekday() -> Weekday {
        return Weekday.Monday
    }
}

Problem is that Calendar View disappears. I don't see the view anymore when I run the project. Menu View works fine. It doesn't look like it is an Auto Layout problem. What can cause the issue?

@ghost
Copy link
Author

ghost commented Mar 23, 2016

Found the reason. The following condition in CVCalendarView.commitCalendarViewUpdate() is evaluated to false:

let allowed = selfSize.width <= screenSize.width && selfSize.height <= screenSize.height

when the constraints for CVCalendarView from left/right are less than zero:

negative constraints

I fixed the constrains and the calendar appears now.

@ghost ghost closed this as completed Mar 23, 2016
@ghost ghost reopened this Mar 23, 2016
@ghost ghost closed this as completed Mar 24, 2016
@MuhammadRizwan95
Copy link

MuhammadRizwan95 commented Dec 28, 2016

@khetag how you did this can explain bit more plz?? im stuck on this issue.

using xcode 8.0 and ios 10.0 simulator 6s. CVCalendar 1.4.1

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant