Do you want to see the iOS fonts?
Look at… http://iosfonts.com/
1 nota
When you get a NSError object back from a method like this
[myContext save:&error];
you can read a detailed explanation of the error using this method (of class):
+(void)getErrors:(NSError *)error
{
if (!error)
return;
NSLog(@”Failed to %@”, [error localizedDescription]);
NSArray* detailedErrors = [[error userInfo] objectForKey:NSDetailedErrorsKey];
if(detailedErrors && [detailedErrors count] > 0)
{
for(NSError* detailedError in detailedErrors)
{
NSLog(@”DetailedError: %@”, [detailedError userInfo]);
}
}
else
{
NSLog(@”%@”, [error userInfo]);
}
}
Write the getErrors method and update your code in this way:
NSError *error = nil;
[myContext save:&error];
if(error != nil)
{
[myClass getErrors:error]; //it’s a method of class
}
else
{
NSLog(@”The best movie of all time, is Back To The Future!”);
}
Good Luck :)
When you create a entity in Core Data, you can choose between some data types for the properties (String, Float, Boolean, Integer 32, Integer 64, etc…).
Finally, when you create the NSManagedObject subclass of the entity (you are using the Data Model), the property data types are modeled to NSObject classes.
String properties are modeled to NSString properties;
Int properties are modeled to NSNumber properties;
Float properties are modeled to NSNumber properties;
Boolean properties are modeled to NSNumber properties;
So int 0 is modeled to 0; float 0 is modeled to 0.0; boolean false is modeled to 0.
Yes ok, now i can obtain the correct value of a property using
[myProperty intValue]; //0
[myProperty floatValue]; //0.0
[myProperty boolValue]; //false
But, i don’t know the data type of the “myProperty” property so i want to determine it! Core Data and Objective-C will help me!
First: get attributes for the entity. This method will returns a NSDictionary where the keys are the attribute names (they are the property names) and the values are instances of NSAttributeDescription.
NSDictionary *entityAttributes = [[currentEntity entity] attributesByName];
Second: get the property data types and determine the real type. This method will return a NSAttributeType.
NSString *currentPropertyName = @”isBooleanProperty”;
if([myProperty isKindOfClass:[NSNumber class]])
{NSAttributeDescription *propertyAttributeDescription = [entityAttributes valueForKey:currentPropertyName];
//if bool value
if([finalValueAttributeDescription attributeType] == NSBooleanAttributeType){ //write here your code! }
}
Valid values for NSAttributeType (it’s a enum) are listed below:
typedef enum {
NSUndefinedAttributeType = 0,
NSInteger16AttributeType = 100,
NSInteger32AttributeType = 200,
NSInteger64AttributeType = 300,
NSDecimalAttributeType = 400,
NSDoubleAttributeType = 500,
NSFloatAttributeType = 600,
NSStringAttributeType = 700,
NSBooleanAttributeType = 800,
NSDateAttributeType = 900,
NSBinaryDataAttributeType = 1000,
NSTransformableAttributeType = 1800,
NSObjectIDAttributeType = 2000
} NSAttributeType;
Good Luck :)
Simply write this code in the UIView Controller:
int degrees = 90; //change me
[self.view setTransform:CGAffineTransformMakeRotation(M_PI * (degrees) / 180)];
It will rotate the UIView of 90°.
The M_PI means pi, 3.141592654, so M_PI * (90) / 180 will rotate the UIView of 1.57… radians (90 degrees)
Good Luck :)
2 note
With the Core Data framework you can manage the model objects in the your database.
With the NSFetchRequest class you can describe search criteria used to retrieve datas from a persistent store.
Finally, with the NSPredicate class you can define logical conditions to filter a search.
Well, when you want to create a new NSPredicate, you can use two important methods:
+ (NSPredicate *)predicateWithFormat:(NSString *)format, …
or
+ (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat argumentArray:(NSArray *)arguments
The first method is used for easy query into the model, contrariwise the second method is used for complex query with one or more arguments.
So, how can i configure a NSPredicate to compare datas and/or other arguments?
Follow the code below, i will explain how to create a new NSPredicate with and without arguments:
//simple predicate format, without arguments
NSString *simplePredicateFormat = [NSString stringWithFormat:@”isDeleted == FALSE”];
//complex predicate format, with arguments
NSDate *currentDate = [NSDate date];NSString *complexPredicateFormat = [NSString stringWithFormat:@”isDeleted == FALSE AND (activationDate == nil OR activationDate <= %@)”];
NSArray *withArguments = [NSArray arrayWithObjects:currentDate, nil];
NSFetchRequest *simpleFetchRequest = [[NSFetchRequest alloc] init];
NSFetchRequest *complexFetchRequest = [[NSFetchRequest alloc] init];
NSPredicate *simplePredicate = [NSPredicate predicateWithFormat:simplePredicateFormat];
NSPredicate *complexPredicate = [NSPredicate predicateWithFormat:complexPredicateFormat argumentArray:withArguments];
[simpleFetchRequest setPredicate:simplePredicate];
[complexFetchRequest setPredicate:complexPredicate];
…execute your query…
Good Luck :)
The Core Data framework provides generalized and automated solutions to common tasks associated with objects in your SQLite Database.
In Core Data you can set up a delete rule for delete any relationship in the current entity.
Many don’t know that you can use a delete rule for propagate changes to a relationship.
Now i will explain you how to do it in XCode.
Step one - create and fill the data model:


Step two - create NSManagedObject subclasses
Step three - use your Data Model :)
Step four - propagate changes to relationships
-(void)propagateToCascade:(id)entity{//set delete property to "true"[entity setValue:[NSNumber numberWithBool:TRUE] forKey:@"delete"];//NSEntityDescription for entityNSEntityDescription *entityDescription = [entity entity];//get relationshipNSDictionary *relationsDictionary = [entityDescription relationshipsByName];//for each relationfor (NSString *relationKey in [relationsDictionary allKeys]){//get relation descriptorNSRelationshipDescription *relationDescription = [relationsDictionary objectForKey:relationKey];//if current relation has not the "cascade" deletion rule...if([relationDescription deleteRule] != NSCascadeDeleteRule)continue;//...else...//if is a multi-entities-relation (is a NSSet)if([relationDescription isToMany]){NSMutableSet *relationSet = [entity mutableSetValueForKey:relationKey];for (id destinationEntityInSet in [relationSet allObjects]){//recursive call[self propagateToCascade:destinationEntityInSet];}}//if is a single-entity-relation (is a NSManagedObject)else{[self propagateToCascade:[relationDescription destinationEntity]];}}}
Good Luck :)
1 nota
I am back… today i will present a new iOS tutorial!
Do you know the UIMenuController?

Well, in the next tutorial, i will explain how use a UIMenuController with a NSButton (you can use any object which inherits from the UIView class, simply connect the object’s action to the correct method).
One more thing, you can download the project here (created with XCode 4.3.2, iOS 5.1 and Storyboard).
Good luck!
3 note
The new iPad is the best iPad… is the best tablet (it’s much more) in the world.
Well, with the new retina display you can play Games, Video and Apps with a revolutionary resolution. The new iPad is not like a Playstation or a Xbox 360, it’s much more!
This is a screenshot made by the new iPad. It’s fantastic… maybe your monitor is not so good then you can only imagine all this!

“One More Thing”… the 4G or LTE (Long Term Evolution) is a standard for wireless communication of high-speed datas. It’s fast (326Mbps download, 86Mbps upload), it’s new (i don’t know other devices with the 4G technology inside), it’s incredible.
That’s incredible!