Questions tagged [objective-c]

This tag should be used only on questions that are about Objective-C features or depend on code in the language. The tags [cocoa] and [cocoa-touch] should be used to ask about Apple's frameworks or classes. Use the related tags [ios], [macos], [apple-watch] and [tvos] for issues specific to those platforms.

Objective-C is an object-oriented programming language combining features of C () and Smalltalk (). It is a strict superset of C (any valid C code is equally valid Objective-C code, with the minor exception that id is a free identifier for user use in C while it is a keyword in Objective-C), and it inherits its object-oriented capabilities from Smalltalk. All procedural syntax is identical to that of C, and all object-oriented syntax is an implementation of Smalltalk messaging.

Objective-C was created primarily by Brad Cox and Tom Love in the early 1980s at their company Stepstone. It is now primarily developed by Apple, Inc.

Objective-C is a general-purpose, high-level, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. It is the main programming language used by Apple for and and their respective APIs, and .

Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. It also adds language-level support for object graph management and object literals while providing dynamic typing and binding, deferring many responsibilities until run time.

Hello World in Objective-C

#import <Foundation/Foundation.h>

int main(void)
{
    NSLog(@"Hello World!");
    return 0;
}

Syntax

Objective-C is a thin layer on top of C, and moreover is a strict superset of C; it is possible to compile any C program with an Objective-C compiler, and to freely include C code within an Objective-C class. Objective-C derives its object syntax from Smalltalk. All of the syntax for non-object-oriented operations (including primitive variables, pre-processing, expressions, function declarations, and function calls) is identical to that of C, while the syntax for object-oriented features is an implementation of Smalltalk-style messaging.

Objective-C has many powerful features as detailed below:


References

Frequently posted questions in the Objective-C tag

Books

Video Tutorial

  • Developing iOS 7 Apps for iPhone and iPad by Stanford University - FREE
    From the site, "Tools and APIs required to build applications for the iPhone and iPad platform using the iOS SDK. User interface designs for mobile devices and unique user interactions using multi-touch technologies. Object-oriented design using model-view-controller paradigm, memory management, Objective-C programming language." (Similar courses are also available for iOS 8 & 9, but only in Swift)

Related Tags

292452 questions
60
votes
4 answers

How to add textField in UIAlertController?

I want to realize a function about changing password. It requires users to input their previous password in an alert dialog. I want to click the button "Confirm the modification" then jump to the other view controller for changing password. I have…
Juice007
  • 1,054
  • 1
  • 9
  • 14
60
votes
12 answers

Replace occurrences of space in URL

I have a URL in an iPhone application to work with. But the problem is that it has some spaces in the URL. I want to replace the spaces with '%20'. I know that there are the stringByReplacingOccurencesOfString and…
Joy
  • 1,609
  • 3
  • 16
  • 28
60
votes
2 answers

iOS is it a static or a dynamic framework?

This might sound like a silly question but If you have a thirdParty.framework file, can you tell if it's static or dynamic? I mean, do they look different if you look inside?
Hadi tavakoli
  • 1,267
  • 2
  • 16
  • 30
60
votes
3 answers

What does @NSManaged do?

I have encountered this keyword in various occasions. I kind of know what it's suppose to do. But I really want a better understanding of it. What I noticed about @NSManaged - based not on documentation, but through repeated use: It magically…
Kelvin Lau
  • 6,373
  • 6
  • 34
  • 57
60
votes
5 answers

Accordion table cell - How to dynamically expand/contract uitableviewcell?

I am trying create an accordion type of uitableviewcell that, when the user selects the cell, it expands to display a detailed info view inline similar to how the digg app works. I initially tried replacing the current tablecell with a customcell in…
s.newave
  • 601
  • 1
  • 6
  • 4
60
votes
3 answers

Understanding Core Data delete rules on One to Many

I am a little fuzzy about Core Data Relationships deletion rules. So if someone could help me answer a few questions about them. I have Entities A and B. A has a to-Many relationship with B, and B has a to-One relationship with A. A<--->>B Now, if I…
Shamy
  • 723
  • 1
  • 8
  • 13
60
votes
26 answers

command/usr/bin/codesign failed with exit code 1- code sign error

I'm currently in the process of submitting my first app to the Apple store. I've completed the following processes Obtained a developer account Logged into the Member Center to Create an App ID Used keychain access to request and receive a…
LeleMarieC
  • 731
  • 1
  • 6
  • 9
60
votes
8 answers

UIWebView delegate method shouldStartLoadWithRequest: equivalent in WKWebView?

I have a module inside my iOS 7+ app which is a UIWebView. The html page loads a javascript that creates custom-shaped buttons (using the Raphaeljs library). With UIWebView, I set delegate to self. The delegate method webView:…
invalidArgument
  • 2,289
  • 4
  • 24
  • 35
60
votes
12 answers

How to specify size for iPhone 6/7 customised edge-to-edge image?

Say I want a bundled image to take up all available screen width in an iPhone app - for example a banner. I'd create my_banner.png with width 320px, my_banner@2x.png with width 640px and my_banner@3x.png for iPhone 6 plus with width 1242px. But the…
Niklas Berglund
  • 3,563
  • 4
  • 32
  • 32
60
votes
12 answers

Rounded Corners on UIImage

I'm trying to draw images on the iPhone using with rounded corners, a la the contact images in the Contacts app. I've got code that generally work, but it occasionally crashes inside of the UIImage drawing routines with an EXEC_BAD_ACCESS -…
Jablair
  • 5,036
  • 4
  • 28
  • 37
60
votes
5 answers

Black bars showing when running app on iOS 7 (4 inch retina display)

We have an iPod app built with base SDK as 5.1. App has a tabBarController with three tabs and each tab has a UIViewController to load a different view. The app works fine for iOS 6.1 and iOS 7 (3.5 inch display) simulator and device but when we run…
User0911
  • 1,552
  • 5
  • 22
  • 33
60
votes
15 answers

Content pushed down in a UIPageViewController with UINavigationController

UPDATE 2 I've been running and testing my app in the iOS Simulator using a 4-inch device. If I run using a 3.5-inch device the label doesn't jump. In my .xib, under Simulated Metrics, I have it set as Retina 4-inch Full Screen. Any idea why I'm only…
djibouti33
  • 12,102
  • 9
  • 83
  • 116
60
votes
15 answers

iPhone UILabel text soft shadow

I know soft shadows are not supported by the UILabel out of the box, on the iPhone. So what would be the best way to implement my own one? EDIT: Obviously I will subclass the UILabel and draw in the -drawRect: My question is, how do I get the…
Dimitris
  • 13,480
  • 17
  • 74
  • 94
60
votes
6 answers

Sample code for creating a NSTextField "label"?

In my desktop Mac OS X app, I'd like to programatically create a NSTextField "label" which has the same behavior and properties as a typical label created in Interface Builder. I usually use (and very much like) IB, but in this case it must be done…
Todd Ditchendorf
  • 11,217
  • 14
  • 69
  • 123
60
votes
5 answers

How to convert JSON serialized data to NSDictionary

I have used this method, NSDictionary *jsonObject=[NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil]; NSLog(@"jsonObject is %@",jsonObject); It's printing…
Rajesh
  • 937
  • 1
  • 8
  • 14