archive-com.com » COM » T » TECHOTOPIA.COM

Total: 1018

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Using Objective-C Preprocessor Directives - Techotopia
    references to the definition A define directive can also contain an expression A somewhat contrived example being define TWOBYTWO 2 2 This can then be referenced in code Continuing with our example the following code will output The result is 4 NSLog Result is i TWOBYTWO Creating Macros with the define Statement The define statement may also be used in a more advanced fashion to create small fragments of code called macros These can be thought of as small functions that can accept arguments perform operations and return results The following definition declares a macro designed to multiply two numbers together define CalcInterest x y x y Having declared the macro we can now call it from the code int earnings CalcInterest 10 5 Changing the Objective C Language with define My first ever job involved writing communications software using the C programming language on which Objective C is based I inherited some code written by a former employee who loathed the C language and preferred to use another programming language the name of which escapes me When I looked at his C code it looked nothing like any C code I had ever seen before in my life After about an hour of trying to understand how this could be possible surely the compiler should have refused to compile this I realized the other programmer had using the define compiler directive to modify the syntax of the C programming language to make it look more like his preferred language Whilst I am not suggesting that you too go to these lengths it is worth knowing that such adaptability is provided by the define preprocessor statement Let s begin with a simple example and write a definition that assigns the word MINUS to the minus sign define MINUS Having done this we can now perform subtractions by using the the word MINUS int result result 20 MINUS 10 NSLog Result i result Now suppose that you rather like the programmer whose code I inherited dislike the curly braces used to encapsulate code blocks on Objective C You could if you were so inclined declare the words Begin and End to represent the open and close braces as follows define Begin define End Having done this you would then be able to write code that looks like this and still have it compile import Foundation Foundation h define Begin define End int main int argc const char argv Begin autoreleasepool int i int j 10 for i 0 i 10 i Begin j i NSLog j i j End return 0 End Undefining a Definition with undef To undefine a definition made previously in a source file use the undef statement define INTEL X86 Objective C code undef INTEL X86 more code Conditional Compilation The preprocessor supports a range of statements designed for the purposes of defining areas of code that should or should not be compiled depending on a particular setting This is of particular importance when you have a

    Original URL path: http://www.techotopia.com/index.php/Using_Objective-C_Preprocessor_Directives (2016-02-13)
    Open archived version from archive


  • Objective-C 2.0 Essentials - Techotopia
    Bitwise XOR Bitwise Left Shift Bitwise Right Shift Compound Bitwise Operators Objective C 2 0 Operator Precedence An Example of Objective C Operator Precedence Objective C Operator Precedence and Associativity Overriding Operator Precedence Commenting Objective C Code Why Comment your Code Single Line Comments Multi line Comments Objective C Flow Control with if and else Using the if Statement Using if else Statements Using if else if Statements Summary The Objective C switch Statement Why Use a switch Statement Using the switch Statement Syntax A switch Statement Example Explaining the Example Combining case Statements Objective C Looping The for Statement Why Use Loops Objective C Loop Variable Scope Creating an Infinite for Loop Breaking Out of a for Loop Nested for Loops Breaking from Nested Loops Continuing for Loops Using for Loops with Multiple Variables Objective C Looping with do and while Statements The Objective C while Loop Objective C do while loops Breaking from Loops The continue Statement An Overview of Objective C Object Oriented Programming What is an Object What is a Class Declaring an Objective C Class Implementation Adding Instance Variables to a Class Define Class Methods Declaring an Objective C Class Implementation Declaring Initializing and Releasing a Class Instance Calling Methods and Accessing Instance Data Creating the Program Section Bringing it all Together Structuring Object Oriented Objective C Code Writing Objective C Class Methods Instance and Class Methods Creating a New Class Method The interface Section The implementation Section The main Function Objective C Data Encapsulation Synthesized Accessors and Dot Notation Data Encapsulation Synthesized Accessor Methods Direct Access to Encapsulated Data Objective C and Dot Notation Controlling Access to Instance Variables Objective C Inheritance Inheritance Classes and Subclasses An Objective C Inheritance Example Extending the Functionality of a Subclass Overriding Inherited Methods Pointers and Indirection in Objective C How Variables are Stored An Overview of Indirection Indirection and Objects Indirection and Object Copying Objective C Dynamic Binding and Typing with the id Type Static Typing vs Dynamic Typing Dynamic Binding Polymorphism Objective C Variable Scope and Storage Class Variable Scope Block Scope Function Scope Global Scope File Scope Variable Storage Class An Overview of Objective C Functions What is a Function How to Declare an Objective C Function Calling an Objective C Function Function Prototypes Function Scope and the static Specifier Static Variables in Functions Objective C Enumerators Why Use Enumerators Declaring an Enumeration Creating and Using an Enumeration Enumerators and Variable Names An Overview of the Objective C Foundation Framework The Foundation Framework Including the Foundation Headers Finding the Foundation Framework Documentation Working with String Objects in Objective C Strings without NSString Declaring Constant String Objects Creating Mutable and Immutable String Objects Getting the Length of a String Copying a String Searching for a Substring Replacing Parts of a String String Search and Replace Deleting Sections of a String Extracting a Subsection of a String Inserting Text into a String Appending Text to the End of a String Comparing Strings Checking for String Prefixes and

    Original URL path: http://www.techotopia.com/index.php?title=Objective-C_2.0_Essentials&oldid=22052 (2016-02-13)
    Open archived version from archive

  • Pages that link to "Objective-C 2.0 Essentials" - Techotopia
    C links Installing and Using GNUstep and Objective C on Linux links Building and Installing GNUstep on Linux links Installing and using GNUstep and Objective C on Windows links Installing Xcode and Compiling Objective C on Mac OS X links Objective C 2 0 Data Types links Working with Variables and Constants in Objective C links Objective C Operators and Expressions links Objective C 2 0 Operator Precedence links Objective C Flow Control with if and else links The Objective C switch Statement links Objective C Looping The for Statement links Objective C Looping with do and while Statements links An Overview of Objective C Object Oriented Programming links Objective C Data Encapsulation Synthesized Accessors and Dot Notation links Writing Objective C Class Methods links Objective C Variable Scope and Storage Class links An Overview of Objective C Functions links Objective C Enumerators links Objective C Inheritance links Objective C Dynamic Binding and Typing with the id Type links An Overview of the Objective C Foundation Framework links Working with String Objects in Objective C links Understanding Objective C Number Objects links Working with Objective C Array Objects links Objective C Dictionary Objects links Working with Directories in Objective C

    Original URL path: http://www.techotopia.com/index.php/Special:WhatLinksHere/Objective-C_2.0_Essentials (2016-02-13)
    Open archived version from archive

  • Objective-C 2.0 Essentials - Techotopia
    Precedence Commenting Objective C Code Why Comment your Code Single Line Comments Multi line Comments Objective C Flow Control with if and else Using the if Statement Using if else Statements Using if else if Statements Summary The Objective C switch Statement Why Use a switch Statement Using the switch Statement Syntax A switch Statement Example Explaining the Example Combining case Statements Objective C Looping The for Statement Why Use Loops Objective C Loop Variable Scope Creating an Infinite for Loop Breaking Out of a for Loop Nested for Loops Breaking from Nested Loops Continuing for Loops Using for Loops with Multiple Variables Objective C Looping with do and while Statements The Objective C while Loop Objective C do while loops Breaking from Loops The continue Statement An Overview of Objective C Object Oriented Programming What is an Object What is a Class Declaring an Objective C Class Implementation Adding Instance Variables to a Class Define Class Methods Declaring an Objective C Class Implementation Declaring Initializing and Releasing a Class Instance Calling Methods and Accessing Instance Data Creating the Program Section Bringing it all Together Structuring Object Oriented Objective C Code Writing Objective C Class Methods Instance and Class Methods Creating a New Class Method The interface Section The implementation Section The main Function Objective C Data Encapsulation Synthesized Accessors and Dot Notation Data Encapsulation Synthesized Accessor Methods Direct Access to Encapsulated Data Objective C and Dot Notation Controlling Access to Instance Variables Objective C Inheritance Inheritance Classes and Subclasses An Objective C Inheritance Example Extending the Functionality of a Subclass Overriding Inherited Methods Pointers and Indirection in Objective C How Variables are Stored An Overview of Indirection Indirection and Objects Indirection and Object Copying Objective C Dynamic Binding and Typing with the id Type Static Typing vs Dynamic Typing Dynamic Binding Polymorphism Objective C Variable Scope and Storage Class Variable Scope Block Scope Function Scope Global Scope File Scope Variable Storage Class An Overview of Objective C Functions What is a Function How to Declare an Objective C Function Calling an Objective C Function Function Prototypes Function Scope and the static Specifier Static Variables in Functions Objective C Enumerators Why Use Enumerators Declaring an Enumeration Creating and Using an Enumeration Enumerators and Variable Names An Overview of the Objective C Foundation Framework The Foundation Framework Including the Foundation Headers Finding the Foundation Framework Documentation Working with String Objects in Objective C Strings without NSString Declaring Constant String Objects Creating Mutable and Immutable String Objects Getting the Length of a String Copying a String Searching for a Substring Replacing Parts of a String String Search and Replace Deleting Sections of a String Extracting a Subsection of a String Inserting Text into a String Appending Text to the End of a String Comparing Strings Checking for String Prefixes and Suffixes Converting to Upper or Lower Case Converting Strings to Numbers Converting a String Object to ASCII Understanding Objective C Number Objects Creating and Initializing NSNumber Objects Getting the Value of a

    Original URL path: http://www.techotopia.com/index.php?title=Objective-C_2.0_Essentials&printable=yes (2016-02-13)
    Open archived version from archive

  • Information for "Objective-C 2.0 Essentials" - Techotopia
    467 Page ID 1198 Page content language English en Page content model wikitext Indexing by robots Allowed Number of redirects to this page 3 Counted as a content page Yes Page protection Edit Allow all users infinite Move Allow all users infinite Edit history Page creator Neil Talk contribs Date of page creation 13 53 14 September 2009 Latest editor Neil Talk contribs Date of latest edit 21 18 1

    Original URL path: http://www.techotopia.com/index.php?title=Objective-C_2.0_Essentials&action=info (2016-02-13)
    Open archived version from archive

  • About iPhone iOS 4 App Development Essentials - Techotopia
    apps from a selection of hundreds of thousands take high resolution photos record video tell you your exact location provide directions to your chosen destination play graphics intensive games and even detect when you put the device to your ear Perhaps the most amazing thing about the iPhone is that all of these capabilities and hardware features are available to you as an app developer In fact once you have an iPhone an Intel based Mac computer the iOS SDK a copy of the Xcode development environment and the necessary skills the only limit to the types of apps you can create is your own imagination and of course the restrictions placed on apps accepted into the Apple App Store Beginning with the basics this book provides an overview of the iPhone hardware and the architecture of iOS 4 An introduction to programming in Objective C is provided followed by an in depth look at the design of iPhone applications and user interfaces More advanced topics such as file handling database management graphics drawing and animation are also covered as are touch screen handling multitasking iAds integration location management local notifications camera access and video playback support The aim of

    Original URL path: http://www.techotopia.com/index.php/About_iPhone_iOS_4_App_Development_Essentials (2016-02-13)
    Open archived version from archive

  • The Anatomy of an iPhone 4 - Techotopia
    the screen when you put the phone to your ear presumably to extend the battery life during a phone call and to avoid making user interface selections with your ear or the side of your face The device also has ambient light detection that adjusts the screen brightness to ensure the optimal screen visibility in a variety of lighting conditions from bright sunlight to darkness Wireless Connectivity The iPhone 4 supports a wide range of connectivity options When within range of a Wi Fi network the device can connect at either 802 11b 802 11g or 802 11n speeds For making phone calls or transferring data when not connected to Wi Fi the device supports GSM EDGE connectivity otherwise known as 2G For faster speeds support is also provided for connectivity via Universal Mobile Telecommunications System UMTS High Speed Downlink Packet Access HSDPA and High Speed Uplink Packet Access HSUPA This is better known as 3G and provides data transfer speeds of up to 7 2 megabits per second The iPhone 4 also includes Bluetooth v2 1 support with Enhanced Data Rate EDR technology Wired Connectivity Given the wide array of wireless options it is not surprising that the iPhone has little need for wired connections In fact the iPhone only has two One is a standard 3 5 mm headset jack for the attachment of headphones or other audio devices The second is a proprietary 30 pin dock connector that by default is used to provide a USB v2 0 connection for synching with a computer system and battery charging In practice however this connection also provides audio and TV output via specialty third party cables Memory The iPhone 4 comes in two editions one with containing 16GB of memory and another with 32GB The memory is in the form of a flash drive Unlike some devices the iPhone lacks the ability to supplement the installed memory by inserting additional flash memory cards Camera The iPhone 4 contains a 5 megapixel autofocus still camera that may also be used to record video at an HD resolution of 720p at a rate of 30 frames per second fps In addition the device also incorporates an LED flash and a VGA resolution 30 fps front facing camera Sensors google IOSBOX google The latest generation of iPhone has an array of sensors that would make even the most die hard 1960s science fiction fan jealous These consist of a proximity sensor that detects when the front of the phone is covered or otherwise obscured an accelerometer that uses the pull of gravity to detect when the device is moved or rotated a three axis gyroscope and an ambient light sensor that detects current environmental light levels Location Detection The iPhone 4 contains a digital compass and GPS support with Assisted GPS A GPS support Essentially this enables the iPhone to detect the direction the device is facing and to identify the current location by detecting radio signals from GPS satellites In the

    Original URL path: http://www.techotopia.com/index.php/The_Anatomy_of_an_iPhone_4 (2016-02-13)
    Open archived version from archive

  • The iOS 4 Architecture and SDK Frameworks - Techotopia
    as that on the iPhone it didn t make much sense to name it iPad OS Instead Apple decided to adopt a more generic and non device specific name for the operating system Given Apple s predilection for names prefixed with the letter i iTunes iBookstore iMac etc the logical choice was of course iOS Unfortunately iOS is also the name used by Cisco for the operating system on its routers Apple it seems also has a predilection for ignoring trademarks When performing an internet search for iOS therefore be prepared to see large numbers of results for Cisco s iOS which have absolutely nothing to do with Apple s iOS An Overview of the iOS 4 Architecture As previously mentioned iOS consists of a number of different software layers each of which provides programming frameworks for the development of applications that run on top of the underlying hardware These operating system layers can be presented diagrammatically as illustrated in the following figure Some diagrams designed to graphically depict the iOS software stack show an additional box positioned above the Cocoa Touch layer to indicate the applications running on the device In the above diagram we have not done so since this would suggest that the only interface available to the app is Cocoa Touch In practice an app can directly call down any of the layers of the stack to perform tasks on the physical device That said however each operating system layer provides an increasing level of abstraction away from the complexity of working with the hardware As an iOS developer you should therefore always look for solutions to your programming goals in the frameworks located in the higher level iOS layers before resorting to writing code that reaches down to the lower level layers In general the

    Original URL path: http://www.techotopia.com/index.php/The_iOS_4_Architecture_and_SDK_Frameworks (2016-02-13)
    Open archived version from archive



  •