Tagged: Cocoa RSS Toggle Comment Threads | Keyboard Shortcuts

  • Ullrich 19:49 on 13. March 2012 Permalink | Reply
    Tags: Cocoa,   

    Wrapping the tableView in a custom view in UITableViewController 

    Ever wanted to add a different view north of your table view without making it the tableHeaderView?

    Here’s what you need:

    @property (nonatomic, retain) UITableView *internalTableView;
    
    - (void)loadView;
    {
        [super loadView];
        self.internalTableView = self.tableView;
        self.view = [[[UIView alloc] initWithFrame:self.view.frame] autorelease];
        [self.view addSubview:self.tableView];
        self.tableView.frame = self.view.bounds;
    }
    
    - (void)viewDidUnload;
    {
        self.internalTableView = nil;
        [super viewDidUnload];
    }
    
    - (void)dealloc;
    {
        internalTableView = nil;
        [super dealloc];
    }
    
    // here's the finesse
    - (UITableView *)tableView;
    {
        if (!self.internalTableView) {
            return [super tableView];
        }
        return self.internalTableView;
    }
     
  • Ullrich 09:14 on 14. October 2010 Permalink | Reply
    Tags: , Cocoa, , ,   

    Colliding Category Methods 

    After multiple years of Objective-C experience yesterday was the first time that we actually ran into problems with colliding methods in categories.

    Here’s the story (you may skip this part): The issue was, that we added a method -setParameters: to NSMutableURLRequest which takes a dictionary and set’s it as query string or multipart form body depending on the HTTP Method used for sending the request. This method sadly conflicted with a category on the same class defined in a library called OAuthConsumer which doesn’t take a dictionary as argument but rather an array of key-value pairs. Both categories we’re linked to our application as static libraries.

    The result was that our -setParameters: was called with an array although a dictionary was expected. We noticed the problem since NSArray is not responding to -allKeys. It could have gone would have not noticed the problem. Just imagine trying to debug a misbehavior when you’re looking at the wrong piece of code.

    The quintessence, and what basically helped us finding the issue is a environment variable named OBJC_PRINT_REPLACED_METHODS. Similar to NSZombieEnabled you set it in the Arguments tab of your executable info as variable set to environment. Just like this:

     
  • Ullrich 15:57 on 1. September 2010 Permalink | Reply
    Tags: Cocoa, Framework, Mac, ,   

    Embedded Frameworks 

    When embedding frameworks to your Mac app there might be problems of finding a header file. There are three things to check for:

    • The framework needs to have @executable_path/../Frameworks as Installation Directory in it’s build settings.
    • The app should include the following in its framework search path: “$(CONFIGURATION_BUILD_DIR)/$(CONTENTS_FOLDER_PATH)/Frameworks” (including the quotes!)
    • Also make sure to have a Copy Frameworks build phase and that your famework is added to it.
     
    • Ullrich 16:24 on 13. September 2010 Permalink

      When you’re importing the header files make sure to import them “framework style”:

      #import <TheFramework/TheHeader.h>

      If you still can’t find your framework headers make sure your target is actually linked against them.

  • Gernot 16:10 on 27. July 2010 Permalink | Reply
    Tags: Cocoa,   

    If you ever need to explain to a client why enabling iOS4 Multitasking is more than an entry in info.plist, point him to Doms list of non-obvious things to consider: http://cocoa-dom.tumblr.com/post/866039292/the-hidden-complexity-of-ios-4-multitasking

     
    • everydaypanos 14:56 on 7. August 2010 Permalink

      Why write code for “clients” when you can write for yourself. Plus you skip the annoying explanations to others.

      (I would like to suggest that you also use Rewrd as a Micropayments Service for your blog. Thx.)

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel