This blog talks about iOS,Android,Mac,Cocoa,use of social networks, tips and tricks which can be used by you.
Showing posts with label Objective-C Tutorial. Show all posts
Showing posts with label Objective-C Tutorial. Show all posts
Sunday, July 3, 2011
Wednesday, June 29, 2011
Integrating C++ files with Objective-C (tips)
This trick will be helpful for people who are trying to embed Opengl ES code in their iPhone project.
One way to let your compiler know that you will be using mix of C++ and objective-C will be to convert the extension of all .m files to .mm as discussed in one the previous post(LINK) but there is another way if you don't want to change all the extensions !
In your project Settings, Under Build Settings > GCC 4.2- Language
Change the "Compile Source As" value to "Objective-C++"
It will let you compile the code without changing the extensions of all the files.
I found this wonderful tip from Pete Cole blog. LINK
One way to let your compiler know that you will be using mix of C++ and objective-C will be to convert the extension of all .m files to .mm as discussed in one the previous post(LINK) but there is another way if you don't want to change all the extensions !
In your project Settings, Under Build Settings > GCC 4.2- Language
Change the "Compile Source As" value to "Objective-C++"
It will let you compile the code without changing the extensions of all the files.
I found this wonderful tip from Pete Cole blog. LINK
Labels:
.m,
.mm,
C++,
GCC,
Objective-C,
Objective-C Tutorial,
opengl es,
xcode
Thursday, June 16, 2011
Copy items of NSMutableArray into another ?
Lets say you have arrayA and arrayB, arrayB could be NSArray or NSMutableArray.
But arrayA should be mutable.
Here you are copying items from arrayB to arrayA. Make sure you have already alloc memory for arrayA as:
Case 2: If you want to create a copy an array to NSArray, you can do so as following:
But arrayA should be mutable.
[arrayA addObjectsFromArray:arrayB];
Here you are copying items from arrayB to arrayA. Make sure you have already alloc memory for arrayA as:
arrayA = [[NSMutableArray alloc]init];
Case 2: If you want to create a copy an array to NSArray, you can do so as following:
NSArray *db=[[NSArray alloc]initWithArray:availListArray];
Labels:
Copy items,
NSArray,
NSMutableArray,
Objective-C,
Objective-C Tutorial
Tuesday, June 14, 2011
Private and Public Variables in Objective-C
@interface MIMClass : NSObject
{
@private
int _privateVar; //BY convention I usually put _ in front of private variables.
@protected
int _myVar; //By default, every variable you define is in protected mode so if you don't write protected above your variables, they are by default in protected mode.
@public
int publicVar; // Can be accessed by any object,view
}
@endI guess the code above pretty much explains how you can declare the private and public members in Objective-C
Subscribe to:
Posts (Atom)

