iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Can Someone Help Me To Understand What Is This “Delegate”?

I’m learning Objective-C, and I have to do one app. What I’m trying to do, is call from my MainViewController, a SplitViewController, in code. That’s already solved. Now, I have to call multiple DetailViewControllers. I’ve found this example: http://kshitizghimire.com.np/uisplitviewcontroller-multipledetailviews-with-navigation-controller/ I this example, they use MultipleDetailViewsWithNavigatorAppDelegate to declare SplitViewController and MasterViewController, because the SplitViewController is loaded […]

CGPoint location = ];

Can someone please explain what’s exactly going on with this line of code starting at CGPoint. This comes from the -(void)ccTouchesBegan… UITouch* touch = [touches anyObject]; CGPoint location = [touch locationInView:[touch view]]; In particular I’m not understanding the [touch view] part. Thanks

Why alloc method can add retain count

When we call alloc with a Class, I know that count of Object will +1. For example: NSObject *obj = [NSObject alloc];, The reference count of obj will be 1. I read the source code, but I can’t find some code that can tell me why alloc can add the reference count. And some blog […]

NSNumber gives wrong int value

I have a program that gets cookies. One param of this cookie is an NSNumber. So I save it to database as sqlite3_bind_int(addStmt, 2, HEREisNSNUMBER); Saving this value as: cookieObj.created = [paramsDictionary valueForKey:@”Created”]; then I create and object of class, and get this parameter into NSNumber; after that, I have a wrong value. For example: […]

Encoding string arguments for URLs

I created a method to build URLs for me. – (NSString *)urlFor:(NSString *)path arguments:(NSDictionary *)args { NSString *format = @”http://api.example.com/%@?version=2.0.1″; NSMutableString *url = [NSMutableString stringWithFormat:format, path]; if ([args isKindOfClass:[NSDictionary class]]) { for (NSString *key in args) { [url appendString:[NSString stringWithFormat:@”&%@=%@”, key, [args objectForKey:key]]]; } } return url; } When I try to build something like […]

JSONModel returns nil

I’mm using JSONModel to get the JSON from the URL. It’s a very simple object, containing only 2 strings – “name” and “url”. First I made the Object Model: @protocol Tutorial @end @interface Tutorial : JSONModel @property (nonatomic, strong) NSString *name; @property (nonatomic, strong) NSString *url; @end Then Object Feed: #import “JSONModel.h” #import “Tutorial.h” @interface […]

Preloaded Core Data Database in ios5 with UIManagedDocument

I am trying to include a pre-loaded Core Data database in my app. I am using the solution given in this query but it is not working. Rather than copying out the database I have included in the app bundle, the savetoURL command just creates a new empty database file every time. Anybody any idea […]

i wan to place imageview at different position with animation

i am trying to set multiple image on different position this is my code anyone help me to set imageview on different position. – (void)viewDidLoad { [super viewDidLoad]; frameX = 45.0f; frameY = 60.0f; imagearr = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@”King2.png”], [UIImage imageNamed:@”3.png”],[UIImage imageNamed:@”queen.png”], [UIImage imageNamed:@”King.png”],nil]; } -(IBAction)hidebtn:(id)sender { [btn setHidden:TRUE]; [self setCards]; } -(void)setCards { […]

crashing on ios device while navigation using UIModalTransitionStylePartialCurl in xcode 4

i am using UIModalTransitionStylePartialCurl on the ios 4 device,in my test app i have 2 classes where a single button in each class, in first page onclick of the button it ill navigate to 2nd page (by curling the page up) but in the 2nd page when i click backbutton its crashing but not navigating […]

Simple and concise desktop Cocoa NSXMLParser example?

I would like to look through the elements of a file and when one specific element comes out, output the contents in between the tag. I tried to follow the example in the Mac Dev entitled Event Driven XML Programming, but it just doesn’t finish very clearly. It says to make sure I code the […]