Kal Calendar Walkthrough - ios

I am new to obj c and I am not understanding how to use Kal Calendar. Would anyone be willing to help a new app developer walk through the process? I have it installed to my app but don't know how to use it. I understand if you don't respond, I cant find any tutorials on it and google only helped a little.
I am using ios5, storyboards and arc. Thanks in advance.
I had to subclass the calendar with storyboards, is this the best way? I cant get it to display with a navbar any other way.
UPDATED-I don't think subclass is the way to go but I am still working on a solution

I created a view controller to contain the calendar view controller(KalViewController). That view controller is the KalViewControllerDelegate and datasource. I add the KalViewController as a child view controller using the containment introduced on iOS 5. I added the parent view controller of the KalViewController to a popover controller (on an iPad application). I present it from where I wanted to (UIBarButtonItem). The job of the parent view controller is to provide dates for the calendar view, and to provide data to the table view.
Edit: Here's what you need to do:
on
- (void)presentingDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
You need to find your dates (Network, database, etc). Once you fetch the information containing the dates, you call [delegate loadedDataSource:self];
- (NSArray *)markedDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate
This is to show the dates that are marked on the calendar (the ones with the little dot to mark an event on a particular day). Here you use the dates from your model to find the ones that are going to be visible on the calendar for a month.
- (void)loadItemsFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate
This will be called when the user selects a day of a month. This should be used to update the list of objects being shown on the tableview datasource. So, if you keep an array with the dates for the calendar table, update the array with the data for the given day.
and finally:
- (void)removeAllItems
clear your tableview datasource array.
You also have to implement the Calendar's tableview datasource and delegate methods.

Related

How to achieve calendar week view in swift iOS

How can I achieve week view of the calendar in my iOS app as shown below, ideally using Apple calendar components (if any) and also how can I retrieve the selected date.
I have tried using both FSCalender and CVCalender plugins, without much success, as each was missing one element or the other.
The answer is, you lay out a bunch of views and set their contents. Perhaps use a collection view for the horizontal days. Definitely use a table view for the times. There's nothing in the public SDK to do it all for you. You just put together a view hierarchy the normal way.

Imitating split view animation used in iOS Calendar app

I am currently experimenting with a calendar framework I found online which possesses most of the functionality I need. However, I would really like to add a feature similar to the animation in the iOS Calendar where when a date is tapped, the view splits at that location and the selected week moves to the top of the calendar. Its an intuitive way to display info about the selected day. I just need some suggestions as to how this can be achieved since I'm not super familiar with collection views.
The calendar is a grid collection view with months as different sections from what I understand. Is it possible to just stick a supplementary view anywhere in a collection view dynamically? Or maybe I should look into adjusting insets at a specific location? I'm really not sure what direction to take and could use some suggestions.
Here is sort of what I want to do but with a table view.

Swift iOS solution for multiple/relational drop down pickers

I am new to programming iOS and I am not sure on how to implement multiple/relational drop down pickers into my design.
I have a search form in my app that works like a panel-menu. If you click on the search icon then the panel slides in with the search form.
But what is the best way to implement multiple/relational drop down pickers for my search form?
The pickers are relational. First you select a state then you must select a city. Once you selected a state in dropdown1 then dropdown2 should get populated depending on what you selected in dropdown1.
So is there any good solution for this when it comes to design?
I would like to show both pickers at all time. Kinda like a datepicker when year / month / day always is shown.
But if anyone has a good resource example on relational pickers please share.
Thanks in advance,
You can set this up with nested UITableViewControllers.
These types of projects are generally called Master/Detail.
The Master tableView would display the list of categories.
Once the user has selected a category, the specific category is passed to the detail View controller. It queries all the subcategories for that category.
This can all by done in Storyboard, using Auto Layout, self-sizing cells, and a combination of show and unwind segues.
A show segue pushes a (table) view controller onto the navigation controller stack. In your case, the category controller would push a subcategory controller. prepareForSegue:sender: is where the category controller would provide the category to the subcategory controller.
An unwind segue returns from a view controller, popping it off the navigation stack. In your case, the subcategory controller would return (with the selected subcategory information) to the category controller, or a previous view controller.
It may sound like a lot to digest, but if you read up on recent (i.e. for iOS 8) walkthroughs which use these concepts, you'll have learned some acceptable practices for how information and control should flow within an app.
There's one more thing I didn't mention, called Core Data. Core Data, and NSFetchedResultsController would be a great tool to learn and use for the app. It's probably more complex than anything I previously mentioned, but once you get a handle on it, you will really appreciate it, and may end up using it in many apps!
Don't get too bogged down with how your app should look. Focus on how the model and view controllers are written, and get a good understanding of the underlying frameworks. That's more important right now, than any fancy transition/animation.
The design of any app will evolve as you use it. You'll discover what works well, and what doesn't, so don't get too attached to any one way of organizing the data!
Hope that helps! Enjoy programming for iOS, it's a great platform!

Setting NSDate to an NSManagedObject slow?

I am currently developing a Core Data application. I have a table view that shows a list of items whose attribute scheduled (which is a date) is nil and a BOOL attribute is NO. There is a button in each of the table view cells that allows the user to set the date in a modal view. There is a date picker in the modal view. The item is passed to that modal view controller.
The date is set when the user taps the Done button in the modal view. The date is set with this line of code:
self.item.scheduled = self.datePicker.date;
Apparently this line of code causes the UI to be blocked for ~1 second (on a 5th generation iPod touch), which is undesired behavior. I used Instruments and discovered that -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] took over 900.0ms.
Can someone please enlighten me as to what is causing the slowness? I am using just one MOC at the moment. Am I supposed to use another to make the change?
Edit: The method that took the longest time I got from Instruments tells me that the table view controller seems to have tried to re-fetch or update the cell, causing the slowness. I have -com.apple.CoreData.SQLDebug 1 passed on launch though, but no message was shown when the date was set.
This is the call tree I got from Instruments.
CoreDataTableViewController is taken from a book about Core Data that I read. It is mostly the same as the one found here.
I finally found the answer. It turns out Auto Layout is extremely slow when offscreen. This is why it can be seen in the call tree that the layout operation took the majority of time.
The solution I chose was to remove the table view controller as the NSFetchedResultsController's delegate in viewWillDisappear:. Then, in viewWillAppear:, I perform a re-fetch and call reloadData on the table view, and set the NSFetchedResultsController's delegate property back to self (which is the table view controller).
EDIT: As amb mentioned in the comments, the solution above is a bad approach. This is the better approach. I should add that my table view only correctly reloaded when I added
if(self.tableView.window == nil)
return;
also to controllerWillChangeContent:.

iOS - making a list of calendars

I have a problem : I would like to implement a list of calendars (as in Calendar app of ipad) where the user can view a list of months along with their days. The user can pick a particular day and jump to another view ("day" view).
I am trying to do it by using UICollectionView and putting some kind of calendar (like CKCalendar) inside the UICollectionViewCell.
Beside the fact that there is some problem in handling events from calendars, there is also a problem about loading of the view which can take even half a second for let's say 9 cells.
Any advice?

Resources