Day-7 Flashcards
UIDatePicker
implements an object that uses multiple rotating wheels to allow users to select dates and times
Can also be used as a countdown timer
Has an intrinsic width of 320, you can squeeze it down to 240 and still see everything
UIPickerView
numberOfComponentsInPickerView: pickerView:numberOfRowsInComponent: pickerView:titleForRow:ForComponent:
NSDate & NSDateFormatter
NSDate - a representation of a single point in time
NSCalendar - a representation of a particular calendar type (Buddhist, Chinese, Hebrew, etc)
NSDateComponents - a representation of particular parts of a date, like an hour, minute, day, year, etc
NSDate represents a single point in time
Immutable once created
The standard unit of time for date objects is floating point value typed as NSTimeInterval expressed in seconds
Use one of NSDate’s initWithTimeInterval init methods for specific dates creation
Calendars
You use calendar objects to convert between times and date components (years, days, minutes, etc)
Use methods setDay:, setMonth:, setYear:, etc to set those individual components
NSDateFormatter My Favorite <3
You can set the NSDateFormatter’s style to set the desired style of date: NoStyle, ShortStyle, MediumStyle, LongStyle, FullStyle
Supports custom date formatting / style with setDateFormat: method
NSPredicate
Query language describing how data should be fetched and filtered
Describes logic conditions to use when searching collections
Use predicateWithFormat for building simple predicates
- You can use %@ to substitute for an object value (usually a string)
- You can use %K to substitute for an attribute or attributes (via key path)
NOTE: Most collection classes (except NSDictionary, NSIndexSet) can be searched and filtered using NSPredicate
Comparison Operations:-
=, == >=, => !=, <> - the left hand expression is not equal to the right hand expression BETWEEN BEGINS WITH CONTAINS ENDS WITH LIKE MATCHES ANY, SOME ALL NONE IN AND, && OR, ||
self refers to each entity we are querying against
NSManagedObjectResultType - returns managed objects
NSCountResultType - returns the count of all the objects that match the fetch
NSDictionaryResultType - returns the results back in a dictionary
NSManagedObjectIDResultType - returns the object id(s) instead of full-fledged managed objects