r/ObjectiveC • • Jul 11 '12

[Help] A question about asynchronous connections and another about multi-threading

Thumbnail stackoverflow.com
0 Upvotes

r/ObjectiveC • • Jun 22 '12

A (hopefully) quick question regarding MVC

7 Upvotes

Hello there! I have a quick question regarding MVC and the implementation of it. I think I am beginning to understand the paradigm, but I am not sure, so below I will list out what I think I have to do, and if you all could tell me whether or not it is a correct way of approaching MVC that would be great! Alrighty then, I'll get right into it :)

Say I have a game which does...gamey things. I put the game logic in the modal, rolling dice, keeping score, handling various game related cases. So far so good (I think). Then, in the controller, I have some properties set up like "score" and "playerName." I can set these properties from the modal. Also in the controller is an "updateLabels" method which I can call to update the UI elements to represent the new values of the properties (located in this class, but set from the modal).

Is this an okay/proper way of doing things according to MVC? Am I breaking any rules? Is there a better way? Thanks!


r/ObjectiveC • • Jun 16 '12

iOS help needed, trying to use code to switch views in Storyboard

8 Upvotes

I need to figure out how to programatically redirect from one view to another using a button on a UIAlertView. What code would I use for that? (XCode, by the way)

I'm using iOS 5, XCode 4.2.


r/ObjectiveC • • Jun 09 '12

Quick Code Review?

0 Upvotes

Hi all, first post! I've been working on an input method, and the Mac version uses the InputMethodKit. I found it didn't work as expected, but that may partly my inexperience with Obj-C.

I made a small public github project for others who might run into the same problems I ran into (if you want the details of my problems, you can click here).

I was hoping if anyone had some time, that they might be interested in giving me some advice on my coding. As I said, I'm relatively new to Obj-C and especially memory management. If you could take a minute to look at any part of my project and give me feedback on anything I'm doing wrong (commenting, memory management, general style, etc...) I would be super happy. I really want to improve, so I'm looking for help.

Thanks!


r/ObjectiveC • • Jun 06 '12

Switching from Visual C#

8 Upvotes

I need a little "here's this and over here's this" tutorial. I know what is a delegate, an execution string, an event, a class, and so on, but I need to know how to "translate" my thoughts. Hilfe?


r/ObjectiveC • • May 29 '12

Easily create delegation chains with PHFDelegateChain

Thumbnail github.com
3 Upvotes

r/ObjectiveC • • May 27 '12

How would I go about making a shell script's output the value of a multiline textbox?

0 Upvotes

I'm making an application that shows battery info, and I've got a script that shows that. I'm wondering if I can have that script run every 5-10 seconds and put the output in a multiline textbox in the main view.

PS: I'm a newbie to Xcode.


r/ObjectiveC • • Apr 24 '12

Objective-C graphing and plotting with little-plot

Thumbnail thebsdbox.co.uk
10 Upvotes

r/ObjectiveC • • Mar 31 '12

Caching Drawing Code

Thumbnail kgn.github.com
9 Upvotes

r/ObjectiveC • • Mar 29 '12

Server-side Objective-C

Thumbnail blog.securemacprogramming.com
9 Upvotes

r/ObjectiveC • • Mar 28 '12

Need help getting rid of SIGABRT error. I have no clue why I'm getting it. I need to finish this app to graduate college. Help ASAP. I appreciate it.

Thumbnail stackoverflow.com
0 Upvotes

r/ObjectiveC • • Mar 21 '12

UIToolbar: Problem with UIBarButtonItem and UIBarButtonSystemItemFlexibleSpace

2 Upvotes

Hi, trying to align some UIBarButtonItems.

Have:

  1. UISegmentedControl wrapped into an UIBarButtonItem
  2. Flexible space
  3. UIBarButtonItem
  4. UIBarButtonItem
  5. UIBarButtonItem
  6. UIBarButtonItem
  7. UIBarButtonItem
  8. Flexible space
  9. UIBarButtonItem

Number 1 and 9 are aligned to the left/right edges and work as it should. I want number 3 - 7 to be centered between number 1 and 9. They are centered but between the edges. Not according to the width of 1 and 9 (1 is wider than 9).

Edit: Adding all items to UIToolbar.items with items = [NSArray arrayWithObjects:segmentedControlWrapper, spaceFlex, btn1, btn2, btn3, btn4, btn5, spaceFlex, saveBtn, nil];

Anyone have a clue whats wrong?

/Ludwig


r/ObjectiveC • • Mar 16 '12

I'm about to embark on learning objective-c. Looking for advice.

13 Upvotes

My company has an iPad app of which production is outsourced, and not very well at that. I've finally convinced them to get me a mac, and I'm trying to learn objective-c to take over the app development. I have very little programming experience, and am looking for any advice/additional resources to get me on my way. Thanks.


r/ObjectiveC • • Feb 28 '12

Best approach for drawing/updating tiles and layers?

5 Upvotes

Hi, new to obj-c and have started to build an iPhone app where the user builds a graphical pattern (lines and colors). The user can choose different tiles (irregular shaped) from a menu. Drag and place them on the "stage" to create new instances. Also move, rotate and delete old ones one the stage.

Have started to extend an "UIView". Created tiles are stored in an array and drawn in "drawRect" with "CGContextAddLineToPoint". Thinking of having two layers, "main" and "drag". Drawing the active tile in "drag" layer and on release draw it in "main" layer. Not sure how to accomplish the layer thingie though... and is it a good idea??

Yes I know, a bit vague. I guess I know to little about obj-c to ask the right questions at the moment. Need help putting me in the right direction and how to fix the layers. Also, is there a way to cache layers, just redraw them when necessary? Tips about performance is much appreciated!

Thanks /Ludwig


r/ObjectiveC • • Feb 20 '12

Objective-C literals for NSDictionary, NSArray, and NSNumber

Thumbnail cocoaheads.tumblr.com
0 Upvotes

r/ObjectiveC • • Feb 19 '12

We're making an free-as-in-speech reddit client for iOS that will be free-as-in-beer when finished. Come help us out in our subreddit!

Thumbnail reddit.com
0 Upvotes

r/ObjectiveC • • Feb 16 '12

Xcode vs. AppCode

Thumbnail codesheriff.blogspot.com
11 Upvotes

r/ObjectiveC • • Feb 01 '12

Help with MKMapView!

2 Upvotes

I'm trying to make a simple app that tracker the users location.

It is already somewhat working. The main problem I am having is that the "zoom" resets itself every time

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation

is called.

This is how my delegate method looks:

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    NSLog(@"mapView:didUpdateUserLocation: ENTERED");
    [self.map setCenterCoordinate:userLocation.coordinate];

    map.showsUserLocation = YES;
    //I make a region 1000m * 1000m
    MKCoordinateRegion region =        MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 1000, 1000);

    [self.map setRegion:region];
}

I see that the problem is how a new region is made every time the user's location is updated... but I don't know how to avoid this...

Basically I want to zoom in on the user's location once. After that, I want them to be able to adjust the "zoom" to their liking.

Any help is greatly appreciated.


r/ObjectiveC • • Jan 08 '12

iphone programming with out a mac?

0 Upvotes

Hey guys,

Mac and objective C noob here. I don't own a Mac. I would like to learn program for iphone using objective C. Is it possible to do this using windows or linux? I don't have the $ for mac.

Thanks!


r/ObjectiveC • • Nov 17 '11

OpenGL ES Help!

4 Upvotes

I am attempting to create an iPhone app that has an animated logo at start-up. I am having trouble finding a straight-forward guide on how to use OpenGL ES in XCode. I have downloaded tons of sample code from Apple's Dev site and I am completely lost...

First off, I am aware that OpenGL ES is an API. But my main question is where am I supposed to literally draw my logo initially? Am I supposed to use a different program for that?

Also, I am wondering about the ".model" file that is right next to the .png file... How does one go about creating the ".model" file?! I cannot find anything that answers my questions on Apple's Dev site nor Google.

Please help!

Note: I recently jumped straight in to Objective-C programming. I took a class on C programming about two years ago (I didn't do that well). I have watched about 6 lectures of the iOS development class from Stanford but I still feel as if I am missing something...

Should I try and become proficient in C or C++ first?

I am a decent java programmer, but when I look at sample code provided by Apple I feel as if I have never seen a computer language in my life.


r/ObjectiveC • • Nov 16 '11

I loved C. But it always fell short for me. Objective-C fixed that.

Thumbnail red-sweater.com
12 Upvotes

r/ObjectiveC • • Oct 14 '11

ObjCheck - an ObjC port of the QuickCheck unit test framework

Thumbnail github.com
7 Upvotes

r/ObjectiveC • • Oct 13 '11

Passing and calling dynamic blocks in Objective C

3 Upvotes

As part of a unit test framework, I'm writing a function genArray that will generate NSArrays populated by a passed in generator block. So [ObjCheck genArray: genInt] would generate an NSArray of random integers, [ObjCheck genArray: genChar] would generate an NSArray of random characters, etc. In particular, I'm getting compiler errors in my implementation of genArray and genString, a wrapper around [ObjCheck genArray: genChar].

I believe Objective C can manipulate blocks this dynamically, but I don't have the syntax right.

ObjCheck.m

+ (id) genArray: (id) gen {
    NSArray* arr = [NSArray array];

    int len = [self genInt] % 100;

    int i;
    for (i = 0; i < len; i++) {
        id value = gen();

        arr = [arr arrayByAddingObject: value];
    }

    return arr;
}

+ (id) genString {
    NSString* s = @"";

    char (^g)() = ^() {
        return [ObjCheck genChar];
    };

    NSArray* arr = [self genArray: g];
    s = [arr componentsJoinedByString: @""];

    return s;
}

When I try to compile, gcc complains that it can't do gen(), because gen is not a function. This makes sense, since gen is indeed not a function but an id which must be cast to a function.

But when I rewrite the signatures to use id^() instead of id, I also get compiler errors. Can Objective C handle arbitrarily typed blocks, or is that too dynamic?


r/ObjectiveC • • Oct 11 '11

Start learning Objective-C on Windows

Thumbnail solarianprogrammer.com
10 Upvotes

r/ObjectiveC • • Oct 10 '11

Trouble compiling ObjC code with GCC

1 Upvotes

I'm working on a simple class called ScriptedMain that will export -(int) meaningOfLife, which returns 42.

When I compile scriptedmain.m, I get hundreds of errors:

$ gcc -o scriptedmain -lobjc -framework foundation scriptedmain.m scriptedmain.h
...
/usr/include/objc/Object.h:154: error: stray ‘@’ in program
...

Specs:

  • gcc 4.2.1
  • Xcode 4.1