objective-c-category Questions

1

Solved

About anonymous categories: But can't I declare an anonymous category for the second time to split my variables' and methods' definitions? I know that Xcode allows to do so, but will it work with...
Budworth asked 17/1, 2014 at 15:6

1

Solved

I understand we can use associative references to invoke ivar-like behavior in categories. But what's the specific reason behind not being able to declare new ivars in categories? Is it because we...
Spell asked 10/1, 2014 at 3:24

2

I am facing a problem when i try to create 2 category of my OWN Simple Class ( Class name is Car). I created 2 Category for this class just for testing " Car+show.h" & "Car+Protected.h". I Just...
Check asked 17/12, 2013 at 9:48

1

I've been looking for a way to use optional protocol methods and have clean code. In other words: 1: No respondsToSelector: calls all over my code 2. Should work for any method signature, so a cate...

1

Solved

I have a class structure of the type UIViewControllerSubclass : UIViewController, where the only function of UIViewControllerSubclass is to #import UIViewController+Category.h. The reason I a...
Revest asked 29/8, 2013 at 14:14

2

Solved

Background. Please consider the following steps: 1) In Xcode create a new "Single View Application". 2) Create a category NSObject+Extension.h and .m files: // .h @interface NSObject (Extension...
Drumlin asked 27/8, 2013 at 1:30

4

Solved

I want to add some methods to subclasses of NSManagedObject that implement the SOManagedObject protocol. I've tried defining it like this: @interface NSManagedObject <SOManagedObject> (MyExt...
Charleycharlie asked 26/8, 2011 at 20:3

1

Solved

As we know, we can add a variable in Objective-C using a category and runtime methods like objc_setAssociatedObject and objc_getAssociatedObject. For example: #import <objc/runtime.h>...
Heribertoheringer asked 16/7, 2013 at 13:47

2

Solved

I have just started to create my own framework regrouping some usefull helper, utils, tools etc. Everything works fine, I just wondered if it was possible to import my categories directly in my mai...
Miraculous asked 21/6, 2013 at 14:4

1

Solved

I am intentionally using a category to override a method that I know is already implemented on a primary class. I know this is typically a sign of weak design-- please, no lectures-- but I can't su...
Cloudcapped asked 19/1, 2013 at 4:40

1

I'm trying to implement a category for a UIViewController and I want to be certain that the object conforms to a certain protocol. Something like this: #import <UIKit/UIKit.h> @interf...
Pilgrim asked 22/5, 2013 at 2:4

3

Solved

I have an NSString category class (NSString+URLEncoding.h). I am running into and unknown selector crash, because the string I am calling the category method has been optimized into an NSCFConstant...
Platyhelminth asked 10/9, 2012 at 20:0

3

Solved

When you implement a category of a class in a file, will all the instances of that class be of the category by default? I'm new to Objective-C and I'm trying to make my uneditable UITextView non-s...
Suspicion asked 22/4, 2013 at 18:32

2

Solved

I just upgraded my app from Facebook iOS SDK 3.1 to 3.2.1 and I'm trying to take advantage of the new error handling provided by the new FBError category on NSError. The code is at the bottom. It c...
Flagwaving asked 26/3, 2013 at 15:7

2

Solved

I am using an associated reference as storage for a property of my category header file contains : @interface UIImageView (Spinning) @property (nonatomic, assign) BOOL animating; @end impleme...
Rahm asked 17/2, 2013 at 4:58

1

Solved

I know about the possibility of declaring private properties on a class by putting them inside an unnamed category on that class declared in the implementation (.m) file of that class. That's not w...

6

Solved

I would like to add some rounded corners to all of the UIImageViews in my project. I have already got the code working, but am having to apply it to every image; should I subclass UIImageView to ad...
Pushcart asked 31/1, 2010 at 11:37

1

I'm trying to add "properties" to categories using associate objects API. objc_setAssociatedObject(self, &kIsAnimatingAssocObjKey, animating, OBJC_ASSOCIATION_RETAIN_NONATOMIC); Xcode compl...
Cupro asked 18/12, 2012 at 15:41

1

Solved

I am trying to plan how to add a couple methods to all instances of certain objects. I think adding a category to the parent object(UIViewController) would work for what I want to do, but can I ove...
Ship asked 16/7, 2012 at 17:54

7

Solved

Can anyone explain the differences between Protocols and Categories in Objective-C? When do you use one over the other?
Babylon asked 11/12, 2008 at 21:22

2

Solved

I have two projects which the RestKit framework. One project works without problems but another project fails, as soon as the RestKit framework is used. I found out that the failing code is this:...
Unprofitable asked 3/1, 2012 at 15:44

2

Solved

I believe a popular way to declare "private methods" in Objective-C is to create its class extension and declare methods that you would like to make as private. I would like to know more in detail...

2

Solved

This is an extension of this queston: Is it possible to create a category of the "Block" object in Objective-C. Basically while it seems possible to create a category on blocks, either t...

2

Solved

Does a class name, say UIImage+Something or UIImageView+Somethingelse, mean that it acts like a custom UIImage or UIImageView?
Squalene asked 14/7, 2011 at 0:4

2

Solved

I have added a method foo to a class MYCustomClass in a category Category1 separate from the original definition of the class. Then I added another method also called foo in another category Catego...
Laurettalaurette asked 8/6, 2011 at 11:29

© 2022 - 2024 — McMap. All rights reserved.