Closed rustymagnet3000 closed 8 years ago
Try setting your view-controller’s ‘edgesForExtendedLayout’ to UIEdgeRectNone.
I recall experiencing the same thing that you are describing – assuming that I am understanding you correctly – and I found code similar to the above in the sample which solved the problem.
-- /chris
From: Bobby [mailto:notifications@github.com] Sent: December 25, 2015 3:56 PM To: jivesoftware/PDTSimpleCalendar PDTSimpleCalendar@noreply.github.com Subject: [PDTSimpleCalendar] weekdayHeaderEnabled = true - does not show any Day heading (#86)
Any idea if I have made a mistake or stumbled on a bug? I have been using PDTSimpleCalender in my app for about 4 months Works great Love this library
Issue: When I set the weekdayHeaderEnabled to true, nothing happens I can see the option (the predictive text picks the fact it can see the weekdayHeaderEnabled option) I can even set the values Everything compiles fine
I am using the latest version of PDTSimpleCalender (v091)
internal class calenderCollectionView: PDTSimpleCalendarViewController, PDTSimpleCalendarViewDelegate {
var onDataAvailable : ((data: NSDate) -> ())?
func sendData(data: NSDate) { // Whenever you want to send data back to viewController1, check // if the closure is implemented and then call if it is selfonDataAvailable?(data: data) }
override func viewDidLoad() { superviewDidLoad() title = "Select Date"
// initialize my calender
selfdelegate = self
selffirstDate = NSDate()month - 1
selflastDate = NSDate()day + 1
selfweekdayHeaderEnabled = true
selfweekdayTextType = Short
selfcalendar = NSCalendarcurrentCalendar()
}
func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, isEnabledDate date: NSDate!) -> Bool { return true }
func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, didSelectDate date: NSDate!) { sendData(date) dismissViewControllerAnimated(true, completion: nil) }
func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, shouldUseCustomColorsForDate date: NSDate!) -> Bool { return true }
func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, circleColorForDate date: NSDate!) -> UIColor! { return DashboardKitniceBlueColor }
func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, textColorForDate date: NSDate!) -> UIColor! { return UIColorwhiteColor() }
}
— Reply to this email directly or view it on GitHub https://github.com/jivesoftware/PDTSimpleCalendar/issues/86 . https://github.com/notifications/beacon/AI07TZTYYwJ3J6D5b-XYZZ8uZ_EKjz8Qks5pTaT6gaJpZM4G7XiF.gif
Great idea, @csrking
Sadly, it did not work. See how I added your suggestion into my setup of my PDT calender..
self.delegate = self
self.firstDate = NSDate().month - 1
self.lastDate = NSDate().day + 1
self.edgesForExtendedLayout = .None
self.weekdayHeaderEnabled = true
self.weekdayTextType = .Short
self.calendar = NSCalendar.currentCalendar()
@youdy3000 try setting the values before you present the view controller.
vc.weekdayHeaderEnabled = true vc.weekdayTextType = .Short vc.edgesForExtendedLayout = .None let nav = UINavigationController.init(rootViewController: vc) navigationController?.presentViewController(nav, animated: true, completion: { () -> Void in })
@dzorrilla thanks for answering. I like your approach. On first attempt it didn't work but I think was more related to my code. I used the storyboard to connect everything & manage VC connections and navigiation controllers. But I will write it in code (and avoid storyboard).
Before I do, have you got a swift example where you used PDTSimpleCalender?
@dzorrilla & @csrking thank you both. Your answers were the clues I needed. I went back to the objective-C example from @jmig. The key line to achieve what I wanted - while maintaining a good looking Navigation Controller - was calendarViewController.edgesForExtendedLayout = .None
import UIKit import PDTSimpleCalendar
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
var window : UIWindow?
var appNavigationController : UINavigationController?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
let calendarViewController: PDTSimpleCalendarViewController = PDTSimpleCalendarViewController()
calendarViewController.calendar = NSCalendar.currentCalendar()
calendarViewController.lastDate = NSDate()
calendarViewController.weekdayHeaderEnabled = true
calendarViewController.weekdayTextType = .Short
**calendarViewController.edgesForExtendedLayout = .None**
appNavigationController = UINavigationController()
self.appNavigationController!.pushViewController(calendarViewController, animated: false)
window!.rootViewController = appNavigationController
window!.makeKeyAndVisible()
return true
Glad you were able to find a solution!
Any idea if I have made a mistake or stumbled on a bug? I have been using PDTSimpleCalender in my app for about 4 months. Works great. Love this library.
Issue: When I set the weekdayHeaderEnabled to true, nothing happens. I can see the option (the predictive text picks the fact it can see the weekdayHeaderEnabled option) I can even set the values. Everything compiles fine.
I am using the latest version of PDTSimpleCalender (v0.9.1)
internal class calenderCollectionView: PDTSimpleCalendarViewController, PDTSimpleCalendarViewDelegate {
}