puls / objc-timessquare Goto Github PK
View Code? Open in Web Editor NEWTimesSquare is an Objective-C calendar view for your apps.
License: Other
TimesSquare is an Objective-C calendar view for your apps.
License: Other
Each month on the calendar contains a few days of the next month.. When you get to the last row of March 2014, it shows:
30 31 1 2 3 4 5
That's great and how it should be. However, when you scroll down a few months those last days get messed up. I also noticed when I scroll back up to March 2014, they're screwed up too. For example, it should show the above numbers, but after scrolling down a full year and then scrolling back up, instead of the above numbers for March 2014, I get the following:
30 31 11 12 13 14 15
I really like the control and want to use it with my Xamarin project, but this is a show stopper for me. Can the calendar be displayed without showing the next months days at the bottom of the month?
Like this:
30 31 And then NOT show the following month days?
Thanks,
Curtis
The project can't Archive,Why?
But it works fine when Build And Run.
Hello,
I'm experiencing some issues on iOS 7 (reproductible on the latest beta).
I've got an app where I use TimesSquare very basically (almost the same code and assets as in the example project)
The first rows of of the tableview are show with the "selectedBackgroundImage" and the text isn't visible.
the problem is solved when I start scrolling (tableview row reloading/reuse?)
I suspect the CalendarRowCell methods to be called in a wrong way or order?
Does anyone has experienced the same problem?
Thanks,
Thibaut
When running the sample app on an iOS 5 simulator (pulled today from master), the month numbers seem to be running into each other. When scrolling down and back up, it seems to be fixed. It's only appearing on load.
Being unfamiliar with the code, I don't know where to start looking for a possible cause. Anyone have any pointers?
I'm trying to run the Example code in the Test applications. it works just fine if I launch xcode from the project included.
In an effort to get my applications running quickly with a calendar I took the TSQTAViewController and The TSQTACalendarRowCell and all image assets and put them into a new project.
I create the view controller in the main AppDelegate and add the controller as the root view and the result I get is the following.
I don't get any errors It just doesn't render the cells like it should.
UITextAlignmentCenter is deprecated and should be replaced with NSTextAlignmentCenter. This is used in TSQCalendarMonthHeaderCell.m.
my code is
``TSQCalendarView *aa=[[TSQCalendarView alloc]initWithFrame:self.view.bounds];
aa.firstDate=[NSDate date];
NSDateComponents* comps = [[NSDateComponents alloc]init];
comps.year = 2016;
comps.month = 9;
comps.day = 30;
NSCalendar* calendar = [NSCalendar currentCalendar];
NSDate* date = [calendar dateFromComponents:comps];
aa.pagingEnabled=true;
aa.lastDate=date;
[self.view addSubview:aa];``
Is there a way I can set component to start week from Monday? If not then can you please guide me where I need to make changes?
Thanks in advance.
The CocoaPod was updated about 9 months ago while the last commit was 3 months ago.
I noticed at least 1 difference between the CocoaPod version and the master version here on Github.
For example, - (void)scrollToDate:(NSDate *)date animated:(BOOL)animated;
is missing from the CocoaPod
I'm trying to mark day on dateButtonPressed, but it mark's buttons on other months,
I have tried to mark date on selectColumnForDate changing text font, but each time I select another cell, It clears color and returns to previous.
How it's possible to do that?
Best regards
I am trying to make swipe length shorter.
Right now, I need to swipe up/down to move to the previous/next month.
Any way I can change this swipe length?
The header doc says
the delegate method
calendarView:didSelectDate:
will be called
when a new date is selected from the UI but not when this method is called manually.```
but the code does otherwise
When using the pod it looks like i'm only getting version 1.0.0 even though i specify 1.0.1. A tag may need to be moved to fix this.
Hey,
I was wondering if the tag from 1.0.0
could be updated to include the last merged pull requests, that way the CocoaPods spec could be updated cleanly — rather than using a commit hash.
Thanks!
Hi guys,
I have noticed that this method doesn't seem to function correctly (or I have incorrectly implemented it.)
The calendar does not scroll to the desired date, (with animated as either YES or NO) but if you scroll the calendar down, the next month will be correct, and if you scroll back up again the startDate's month will now be visible.
It is as if the calendar needs to be refreshed after the scroll to show the startDate's month correctly.
Have you seen this before?
Many thanks,
Ross Patman.
I'm getting low FPS and stuttering on iPhone 3G S and iPhone 4 devices. With a relatively small calendar (six months), the framerate rarely gets above 30 FPS, and the average is more around 22.
I profiled the thing, and the performance issue seems to be related to the many UIButtons used in each row — as they take a long time to re-layout and re-draw when they are modified.
Before I try to improve performances, I just wanted to know: is this expected on these devices — or am I doing something wrong ?
The announcement blog post mentions how smooth it should scroll :
Stay tuned for the follow-up post about how we took TimesSquare’s performance from stuttering so badly you’d get lost to scrolling like butter.
Is it only for newer devices, or is there something I don't get?
(By the way, thanks to Square for contributing this awesome project and for the clarity of the code)
The labels are floating in the middle of the view when loading it iOS 5.1 or lower. It seems to be working in older versions of the code, but not the latest release.
I would like to set a custom background image for each cell in the calendar how would I go about doing this? Thanks in advance
Do not set the TSQCalendarView Frame, only full screen?
Any plans to update this pod for iOS 8?
Currently, the UITableViewDelegate method tableView:heightForRowAtIndexPath:
in TSQCalendarView delegates to the cell or header implementation class (rather, an instance of one) to determine the height for a particular row.
This has a measurable impact on performance.
Simply replacing:
return [(id)[self tableView:tableView cellForRowAtIndexPath:indexPath] cellHeight];
With this hardcoded snippet, as a test:
if (indexPath.row == 0 && !self.pinsHeaderToTop) {
return 65.f;
} else {
return 46.f;
}
Shaves about 250ms off the time taken to initialize and display the calendar. Since I display the calendar as a part of the user editing "form" fields, speed of loading is nice to have ;)
I'm not sure what would be the best way to tackle this as a proper fix while retaining extensibility, maybe pull it off of the custom cell class object if the class object responds to cellHeight
? Just a wild stab.
For your reference, here are some Instruments screenshots, before and after making the change.
Any date between April and October will return the date for the previous day.
Example: Selecting 1st April will return 31st March
Hello,
If you want the firstDate to be in the past, but the SHOWN date when you load the view to be current date. Like when the view is loaded, the date shown is the currentDate, but you can scroll up to see past dates.
Is that possible? :)
I tried to use the "Selected Date", but when the selectedDate is outside the visible Area, xcode comes with error.
After fiddling with the code, it doesn't seem to support the GMT timezone. Even in the sample app, if you change the Gregorian calendar's timezone to GMT, it throws off everything in the calendar view.
Hello,
How to display one month at a time ? With button next and previous on the header ?
Hy i wanted dinamically change rowcell parameters, but couldn't figure out,how to do this. In runtime i get some json object, and i want fill the background image from this object.
How can i do this, or can i do this?
First I want to say that I took a look at mattgrayson issue mine is similar to that. Every time I tap on a new date I want the previous selected dates to stay selected. I commented out newIndexOfSelectedButton in mattgrayson's request which seems to do the trick, however if I scroll to the next month and then back, all but the last selected date disappears.
This may well be my own ignorance, but I keep having a problem getting the Test App to run if I use NSChineseCalendar instead of one of the listed ones (Hebrew, Indian, Persian, etc.) For some reason the calendar.firstDate in the loadView method returns 2609-12-26 and calendar.lastDate equals 2602-02-17. And this throws an NSRangeException on the sectionForDate method (it returns 57155). Can anyone point me to where I am going wrong? Thanks!
Hy,
I have to change the start day of a month. I want count the day from monday, or wednesday. How can i do this?
Thanks for your answer.
Update: Forgot built-in method :/
I have a calendar view which I set up like so:
_calendarView = [[TSQCalendarView alloc] init];
_calendarView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_calendarView.delegate = self;
_calendarView.rowCellClass = [C3CCalendarRowCell class];
_calendarView.pagingEnabled = YES;
_calendarView.firstDate = [NSDate dateWithTimeIntervalSince1970:0];
_calendarView.lastDate = [NSDate dateWithTimeIntervalSince1970:(36525 + 364) * kSecondsInADay];
_calendarView.selectedDate = selectedDate;
[self.contentView addSubview:_calendarView];
C3CCalendarRowCell
just defines some images, as per the example app. When I scroll to the start of 2010, I see this:
Looking in the debugger, I see that something weird is going in inside -[tableView:numberOfRowsInSection:]
. firstWeek
is 3, but nextToLastWeek
is 53, so that section has minus 47 rows.
Could this be because my calendar locale is en_GB
? It's possible we have different rules about week numbers in Britain; I have no idea.
Hello,
My calendar is displaying well, with option self.calendarView.pinsHeaderToTop = YES;
I created my own button "Next month" "Previous button", it works, the calendar change, but the month's name in the header still the name (whatever the local i use)
-(IBAction) onClickButtonNextMonth
{
self.calendarView.firstDate = newDate;
self.calendarView.lastDate = newDate;
self.calendarView.selectedDate = newDate;
[self.calendarView scrollToDate:newDate animated:YES];
}
In the current implementation, dates are selected on touch down, not touch up. This feels awkward, and does not match the native iOS calendar app.
This can be partially resolved by modifying TSQCalendarRowCell
on lines #59 and #90 to use UIControlEventTouchUpInside
instead of UIControlEventTouchDown
. However, the following issues still remain:
I don't know the code base well enough to resolve those other issues without reading through everything. I'm happy to put some work into fixing this if someone can point me in the right direction. (I just opened this project for the first time today.)
For comparison, note that the similar project MNCalendarView doesn't have these issues, although that project is lacking many things available in this one.
This won't run. No errors, just nothing happens except a message that it cleaned successfully. I'm a newbie, so probably I'm doing something pretty basic wrong. Any ideas? I'm not familiar with .podspec files. Maybe that's it?
Thanks!
Is possible to disable some dates
Hello,
I need to display the calendar among some other view in my VC. so i put TSQCalendarView as subview (using IBOutlet)
So here is my VC :
@interface CalendarVC : UIViewController
{
}
@Property (nonatomic , retain) IBOutlet TSQCalendarView *calendarView;
And on my .m file i have :
(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
CGRect frame = self.parentViewController.view.bounds;
self.calendarView = [[TSQCalendarView alloc] initWithFrame:frame];
self.calendarView.firstDate = [NSDate date];
self.calendarView.lastDate = [[NSDate date] dateByAddingTimeInterval:60 * 60 * 24 * 10]; // approximately 279.5 days in the future
self.calendarView.delegate = self;
calendarView.pinsHeaderToTop = YES;
}
The problem is that i got many errors from TSQCalendarView
*** -[__NSCFCalendar components:fromDate:toDate:options:]: fromDate cannot be nil
It is like if the firstDate object was loose ...
Did i miss something ?
I was wondering if it could be possible to mark dates like in Calendar.app so that the user knows that the date already has events, etc.
NSDateComponents' week property has been deprecated and should be replaced with weekOfMonth or weekOfYear. This is used in TSQCalendarView.m.
On initial display, the numbers aren't rendered until they scroll off the screen and then back on.
For easier installation?
When we switch on pinsHeaderToTop, there are repeated rows for the "final row" of the past month, and the "first row" of the next month. Also, in the first instance, the past month's days are selectable, and in the second instance of the row, only the next month's days are selectable.
This happens with pagingEnabled or disabled - its a pity, because the pinsHeaderToTop looks great otherwise.
Hi,
I was trying out your component on Xamarin Component and i get an exception while running the sample.
System.MissingMethodException: Method not found: 'MonoTouch.ObjCRuntime.Runtime.GetNSObject'.
at TimesSquare.iOS.TSQCalendarView.EnsureTSQCalendarViewDelegate () [0x00000] in <filename unknown>:0
at TimesSquare.iOS.TSQCalendarView.add_DidSelectDate (System.EventHandler`1 value) [0x00000] in <filename unknown>:0
at TimesSquareiOSSample.TSQTAViewController.LoadView () [0x000a5] in /Users/mohibsheth/Projects/Data3s/Svn/eluzzionNative/50 - Implementation/Prototypes/UIPrototype/Components/timessquare-1.0.2/samples/TimesSquareiOSSample/TimesSquareiOSSample/TSQTAViewController.cs:43
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend_IntPtr (intptr,intptr,intptr)
at MonoTouch.UIKit.UITabBarController.set_ViewControllers (MonoTouch.UIKit.UIViewController[] value) [0x00028] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UITabBarController.g.cs:172
at TimesSquareiOSSample.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x000aa] in /Users/mohibsheth/Projects/Data3s/Svn/eluzzionNative/50 - Implementation/Prototypes/UIPrototype/Components/timessquare-1.0.2/samples/TimesSquareiOSSample/TimesSquareiOSSample/AppDelegate.cs:53
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at TimesSquareiOSSample.Application.Main (System.String[] args) [0x00008] in /Users/mohibsheth/Projects/Data3s/Svn/eluzzionNative/50 - Implementation/Prototypes/UIPrototype/Components/timessquare-1.0.2/samples/TimesSquareiOSSample/TimesSquareiOSSample/Main.cs:17
When selecting a date on the calendar, the last selected numeric date value seems to persist in the current selected button’s title, but only after you’ve selected a date other than the first date that can be selected in the calendar. If you go back and select the first date that can be selected and select another date, it’s fine. But after that, any date you select besides the first one that can be selected will have the previous date’s value.
Example: select 1/12, 1/13 and then 1/14. The title for the 1/14 button will actually be "13". If you select 1/12 again, selecting 1/13 will show "13". But if you select 1/14 again, "13" will be shown for 1/14's button title.
Something seems to be up with TSQCalendarRowCell.m –selectColumnForDate: on line 262, but if you add some NSLog statements to verify the value of the button title that is being set, it’s using the correct value and nothing seems to be wrong.
Hello,
Sorry to bother you again and again.
I did calendarView.pinsHeaderToTop = YES; but here is the result :
With calendarView.pagingEnabled set to YES or NO it is the same.
Maybe it is not possible to automatically display Next and Previous button, if not, it is OK, i can add them, but i just was wondering if it is possible
thanks
When setting the selectedDate
property to nil, I get this warning:
2013-03-19 08:44:58.903 MyApp[73936:c07] *** -[__NSCFCalendar components:fromDate:]: date cannot be nil
I mean really, what do you think that operation is supposed to mean with a nil date?
An exception has been avoided for now.
A few of these errors are going to be reported with this complaint, then further violations will simply silently do whatever random thing results from the nil.
Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
(
0 CoreFoundation 0x0271aa75 -[__NSCFCalendar components:fromDate:] + 85
1 MyApp 0x001c5220 -[TSQCalendarView clampDate:toComponents:] + 128
2 MyApp 0x001c265e -[TSQCalendarView setSelectedDate:] + 94
3 MyApp 0x0011ba19 -[C3CDateView initWithSelectedDate:] + 841
4 MyApp 0x0011b1ad -[C3CDateController loadView] + 125
5 UIKit 0x014baff8 -[UIViewController loadViewIfRequired] + 73
6 UIKit 0x014bb232 -[UIViewController view] + 33
7 UIKit 0x014bb4da -[UIViewController contentScrollView] + 36
8 UIKit 0x014d28e5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
9 UIKit 0x014d29cb -[UINavigationController _layoutViewController:] + 43
10 UIKit 0x014d2c76 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
11 UIKit 0x014d2d71 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
12 UIKit 0x014d389b -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
13 UIKit 0x014d39b9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
14 UIKit 0x014d0c15 -[UINavigationController defaultFirstResponder] + 156
15 UIKit 0x014e8a72 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 36
16 UIKit 0x014e8b2a -[UIResponder(Internal) _promoteDeepestDefaultFirstResponder] + 36
17 UIKit 0x016c80e6 -[UIWindowController transitionViewDidStart:] + 84
18 UIKit 0x0149966a -[UITransitionView _didStartTransition] + 82
19 UIKit 0x0149a498 -[UITransitionView transition:fromView:toView:removeFromView:] + 1286
20 UIKit 0x016c7f44 __91-[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:]_block_invoke_0238 + 485
21 UIKit 0x016c74ee -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 6377
22 UIKit 0x014c3ee3 -[UIViewController presentViewController:withTransition:completion:] + 4521
23 UIKit 0x014c4167 -[UIViewController presentViewController:animated:completion:] + 112
24 UIKit 0x0b683071 -[UIViewControllerAccessibility(SafeCategory) presentViewController:animated:completion:] + 71
25 MyApp 0x00019f8b -[C3CSurveyController showDateControllerForQuestion:] + 523
26 MyApp 0x00017655 -[C3CSurveyController questionsTable:didSelectQuestionAtIndexPath:] + 197
27 MyApp 0x0000fa66 -[C3CQuestionsTable tableView:didSelectRowAtIndexPath:] + 134
28 UIKit 0x01489285 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1194
29 UIKit 0x014894ed -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 201
30 Foundation 0x01e935b3 __NSFireDelayedPerform + 380
31 CoreFoundation 0x026cc376 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
32 CoreFoundation 0x026cbe06 __CFRunLoopDoTimer + 534
33 CoreFoundation 0x026b3a82 __CFRunLoopRun + 1810
34 CoreFoundation 0x026b2f44 CFRunLoopRunSpecific + 276
35 CoreFoundation 0x026b2e1b CFRunLoopRunInMode + 123
36 GraphicsServices 0x0307e7e3 GSEventRunModal + 88
37 GraphicsServices 0x0307e668 GSEventRun + 104
38 UIKit 0x013d9ffc UIApplicationMain + 1211
39 MyApp 0x000024ed main + 141
40 MyApp 0x00002415 start + 53
41 ??? 0x00000001 0x0 + 1
)
I guess this is because setSelectedDate:
is performing some calculations to work out which cell to select.
The calendar renders dates from the next and previous month, but these are selectable. In my user testing users have tried to tap these dates and think they are not available. Seems like it would be better if they could just be proxy's to the real dates.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.