Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
June 27, 2017, 08:41:22 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: Newbie here just saying hello.  (Read 3502 times)
blur
Newbie
*
Posts: 8


chee!


« on: October 11, 2015, 06:09:47 PM »

This is my first post here and just saying hello! I started in Objective-C (for the second time) a few weeks ago. I am in chapter 5. Fourth edition. It is a great book so far.
Thanks
Logged
blur
Newbie
*
Posts: 8


chee!


« Reply #1 on: October 31, 2015, 10:43:56 PM »

Hello blur, welcome! lol was just responding to myself since no one else has said hello. Maybe I am saying hello in the wrong place... well, anywho...

I have an array question. I am almost finished with my very first iPhone app written in... you guessed it... Objective-C...

I am from a php, javascript background. I am used to making arrays indexed by key value,
e.g.

<?php
$array = array(
    'fruit1' => 'apple',
    'fruit2' => 'orange',
    'fruit3' => 'grape',
    'fruit4' => 'apple',
    'fruit5' => 'apple');

// this cycle echoes all associative array
// key where value equals "apple"
while ($fruit_name = current($array)) {
    if ($fruit_name == 'apple') {
        echo key($array).'
';
    }
    next($array);
}
?>
my question, Is there a way to do something similar in objective-C

The array I would like to build would be something like
array[0] = -411; // negative value
array[1] = -410;
array[2] = -409;
array[3] = -408;
Thanks in advance for any and all help

« Last Edit: October 31, 2015, 10:46:04 PM by blur » Logged
blur
Newbie
*
Posts: 8


chee!


« Reply #2 on: August 24, 2016, 11:13:48 AM »

Okay I have made leaps and bounds more progress with Objective-C and iOS programming. I have figuired this out myself. I use two NSArrays with the same number of elements. Then access the array index of the other NSArray [objectAtIndex]. It works geat.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 classroomM.com. All rights reserved.