objective-c-literals Questions

4

Solved

I was going through the release notes for Xcode 4.4 and noticed this: LLVM 4.0 Compiler Xcode now includes the Apple LLVM Compiler version 4.0, including the following newObjective-C language...
Neumeyer asked 19/2, 2012 at 8:17

4

Solved

Now that we have NSNumber literals with compiler support in Objective-C, is there a preferred way to compare an NSNumber to a known integer value? The old way is [myNumber integerValue] == 5 Now ...
Glenn asked 14/2, 2013 at 20:9

7

Solved

I wrote this simple code to try out the new Objective-C literal syntax for NSArrays: NSArray *array = @[@"foo"]; NSLog(@"%@", array[0]); The first line works fine, but the sub...

3

Solved

There is a literal syntax to add object and change object in an NSMutableDictionary, is there a literal syntax to remove object?
Horvath asked 26/2, 2014 at 20:30

4

Solved

I really like the new literals in Objective-C. I am wondering if with the new additions there's a better way to compare numbers. For example, if I want to compare a and b: a = @1; b = @2; Is t...
Drawee asked 11/9, 2012 at 1:55

2

I was wondering what this convenience method stood for but was unable to find any answers for it. What exactly does theDictionary[@"key"] do when wanting to extract a value from a dictionary? Is i...
Flintshire asked 23/6, 2016 at 18:1

5

Solved

I know I can create an NSArray with @[@"foo", @"bar"] or an NSDictionary with @{@0 : @"foo", @1 : @"bar"}. Is there a literal syntax for creating an NSMutableArray or an NSMutableDictionary?

3

Solved

I'm creating a custom navigation bar class and customizing it's title attributes using the following code: self.titleTextAttributes = @{ UITextAttributeFont: bariol, UITextAttributeTextColor: [UI...
Tiberius asked 26/2, 2013 at 21:25

3

Solved

In Objective-c what is the difference between @YES/@NO and YES/NO? What types are used for each?
Danita asked 3/6, 2015 at 5:38

3

Solved

I noticed that both array[index] and [array objectAtIndex:index] work with mutable arrays. Could someone explain the difference between them? in terms of performance, and which one is the best prac...
Crampton asked 28/3, 2015 at 15:49

2

Solved

Xcode think that this: NSArray *persons = @[ @{ @"name": @"Bob", @"pet": @"cat" }, @{ @"name": @"Alice", @"pet": @"dog" } ]; would be better indented like so: NSArray *persons = @[ @{ @...
Gottfried asked 14/9, 2012 at 22:50

1

What does it mean when you put an @ before an integer in Objective-C? Like so: @4
Rattlepate asked 13/7, 2013 at 11:45

4

Solved

I love the shorthand handling of string literals in Objective C with the @"string" notation. Is there any way to get similar behavior with NSNumbers? I deal with numbers more and it's so tedious ha...
Anglofrench asked 20/9, 2010 at 12:9

2

Solved

Although the overloading of @ begins to tread on dangerous territory, I love the addition of the new Objective-C literals in Clang 3.1. Unfortunately the new literals are of limited use to me. Exce...
Edee asked 28/6, 2012 at 20:28

1

Solved

I know that I can do this to : NSMutableArray *objects = [@[objectOne, objectTwo] mutableCopy]; NSObject *someObject = [NSObject new]; objects[0] = someObject; But is there a way for the new lit...
Silsbye asked 22/3, 2013 at 16:16

2

Solved

I have just realised that I can access NSDictionary using both objectForKey: and dict[key]? NSDictionary *coordsDict = @{@"xpos": @5.0, @"ypos": @7.2, @"zpos": @15.7}; NSLog(@"XPOS: %@", coordsDic...
Cupel asked 14/2, 2013 at 15:38

2

Solved

Is there a difference between NSArray *myArray = @[objectOne, objectTwo, objectThree]; and NSArray *myArray = [NSArray arrayWithObjects:objectOne, objectTwo, objectThree, nil]; Is one preferr...
Nervine asked 25/1, 2013 at 17:49

1

Solved

Possible Duplicate: How to wrap a Struct into NSObject Can the new Clang Objective-C literals be redirected to custom classes? I have a custom struct: typedef struct { float f1; f...
Pabulum asked 29/10, 2012 at 16:23

2

Solved

PHP has: arr[] = 'Push this onto my array'; Where the string will be added to the end of the array. Is there any equivalent of this in the new Objective-C literal syntax? The most succinct way ...
Jumbo asked 15/10, 2012 at 7:7

3

Solved

Possible Duplicate: Should I prefer to use literal syntax or constructors for creating dictionaries and arrays? Is there any difference between: NSArray *array = @[@"foo", @"bar"]; ...
Niemann asked 11/10, 2012 at 7:37

1

Solved

Possible Duplicate: Is literal creation of an NSMutableDictionary less efficient than the class helper method? According to the WWDC video that introduces ObjectiveC literals, NSMutab...

3

Solved

I am reading through the iOS Developer Guide to get familiarized with the Objective-C language and currently I am having a little confusion on the topic of Container Literals and Subscript Notation...
Padova asked 21/9, 2012 at 18:7

2

Solved

Using XCode 4.4's Convert to Modern Objective C Syntax, my [NSNumber numberWithBool:YES] calls were converted to @(YES). I had some issue that I've now forgotten, and changed them myself to @...
Thaumatology asked 28/7, 2012 at 0:24

1

Solved

Is it appreciably more efficient to create an NSMutableDictionary using a constructor [NSMutableDictionary dictionaryWithObjectsAndKeys:@"object1", @"key1", @2, @"key2", nil]; than taking the mu...
Residence asked 14/9, 2012 at 14:43

2

Solved

I'm using Clang's primitive-boxing feature to pack an enumeration member into NSNumber The Boxed Enums section of the Clang doc about this says that the compiler boxes enumeration members into int...
Florinda asked 22/8, 2012 at 10:32

© 2022 - 2024 — McMap. All rights reserved.