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

Objective-C: @class Directive before @interface?

What is the difference between these two class declarations? I don’t understand why @class is utilized here. Thanks. @class TestClass; @interface TestClass: UIView { UIImage *image1; UIImage *image2; } and @interface TestClass: UIView { UIImage *image1; UIImage *image2; }

Objective-C Asynchronous Web Request with Cookies

I am writing a program in Objective-C and I need to make web requests to web server, but asynchronously and I am fairly new on mac, I am very good at windows technologies, but I need to know that if I use NSOperation (introduced in 10.5, i am assuming that it will not run in […]

Can I access the keychain on the iPhone?

This question discusses encrypting data on the iPhone using the crypt() function. As an alternative, is there a keychain on the iPhone and if so, what code would I use to access it in order to store login details and then retrieve them for us in an application?

What is the difference between valueforKey:, objectForKey:, and valueForKeyPath:?

I have 2 questions: What is the difference between valueForKey: and objectForKey:? Is it that one is for NSDictionarys (objectForKey:) and for others it is valueforKey:, or is it the reverse? Also what is the difference between valueForKey: and valueForKeyPath:? Has it got something to do with Core Data? Please help.

Add UIView Above All Other Views, Including StatusBar

I’m wanting to create a view (UIControl) which blocks all input and shows a UIActivityIndicatorView while authenticating a user. The UIActionSheet and UIAlertView both manage to add a black semi-transparent view over the top of all other views to block input and I’d like to do similar. I’ve tried adding my view to the top […]

iPhone – dequeueReusableCellWithIdentifier usage

I’m working on a iPhone app which has a pretty large UITableView with data taken from the web, so I’m trying to optimize its creation and usage. I found out that dequeueReusableCellWithIdentifier is pretty useful, but after seeing many source codes using this, I’m wondering if the usage I make of this function is the […]

Dispatch queues: How to tell if they're running and how to stop them

I’m just playing around with GCD and I’ve written a toy CoinFlipper app. Here’s the method that flips the coins: – (void)flipCoins:(NSUInteger)nFlips{ // Create the queues for work dispatch_queue_t mainQueue = dispatch_get_main_queue(); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, NULL); // Split the number of flips into whole chunks of kChunkSize and the remainder. NSUInteger numberOfWholeChunks = nFlips […]

Enable access for assistive devices programmatically on 10.9

I want to enable access for assistive devices programatically on 10.9. On 10.8 and lower I¬†was using following Applescript to enable access for assistive devices: tell application “System Events” if UI elements enabled is false then set UI elements enabled to true end if end tell With 10.9, Apple has moved the accessibility options to […]

CALayer: add a border only at one side

I can add a border to a CALayer in this way: [webView.layer setBorderColor: [[UIColor colorWithRed:0.6 green:0.7 blue:0.2 alpha:1] CGColor]]; [webView.layer setBorderWidth: 2.75]; But is it possible to add a border only at one side? I only need a border at the bottom. Or can I reach this with other properties, e.g. frame, bounds, mask, …? […]

Pixel Width of the text in a UILabel

I need to draw a UILabel striked through. Therefore I subclassed UILabel and implemented it as follows: @implementation UIStrikedLabel – (void)drawTextInRect:(CGRect)rect{ [super drawTextInRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextFillRect(context,CGRectMake(0,rect.size.height/2,rect.size.width,1)); } @end What happens is that the the UILabel is striked through with a line being as long as the whole label, but the text can be […]