Questions tagged [nsinteger]

An NSInteger is a data type in Objective-C. It is used to describe an integer.

An NSInteger is data type in Objective-C used to describe an integer. When building 32-bit applications, NSInteger is a 32-bit integer. A 64-bit application treats NSInteger as a 64-bit integer.

258 questions
3
votes
2 answers

Objective C - Why 64bit means different variable types

I have heard that people use types such as NSInteger or CGFloat rather than int or float is because of something to do with 64bit systems. I still don't understand why that is necessary, even though I do it throughout my own code. Basically, why…
bendu
  • 391
  • 4
  • 15
3
votes
1 answer

Changing Parameter Type for Delegate Methods

I have a NSURL delegate method which takes in NSInteger as the parameter - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten…
user1861763
  • 135
  • 11
3
votes
1 answer

Set view's NSinteger property to NSInteger?

I'm trying to set a variable on a view that im getting ready to load. Heres the code for setting it: NSInteger amountOfQuestions = [self.questions.text intValue]; Timer_ViewController *tvc = [[Timer_ViewController alloc]…
Jonah Katz
  • 5,230
  • 16
  • 67
  • 90
3
votes
1 answer

Converting CFIndex to NSInteger

This question is similar to mine, but does not contain an answer. I want to convert a CFIndex into an NSInteger. I have checked the list of types that have toll-free bridging and this is not one of them.
2
votes
1 answer

Getting access to an outputted 'NSInteger' in rest of my code

I am trying to do something I thought would be relatively simple and get the current day of the week, then make some checks against that day when buttons are tapped. to get the day of the week I have used the following code in my viewDidLoad…
Paul Morris
  • 1,763
  • 10
  • 33
  • 47
2
votes
2 answers

retrieving integer value from the UITextField into a NSInteger variable

UITextField *textField; NSInteger intRollNumber; I want to take rollNumber as input from the textField and store the value into intRollNumber . How i do that? Because I am unable to convert the string into integer.
SST
  • 2,040
  • 5
  • 26
  • 42
2
votes
1 answer

How do I format an NSInteger to represent minutes as zero padded digits like 00, 05...?

I'm building a UIPickerView to resemble a custom subclass of UIDatePicker, timepicker style. Anyway, the minutes component should have numbers for every 5 minutes, starting with 00, 05, and then 10, 15, etc... How do I get the zero number padding…
MiguelB
  • 1,913
  • 18
  • 20
2
votes
4 answers

Want to pass integer value to the another view

I am creating an iphone app in which i have some vale in integer in my oneviewcontroller and i want that integer value in my secondviewcontroller controller. value will be random. I stored this integer value in id score Nw I am using this code but,i…
iUser
  • 1,075
  • 3
  • 20
  • 49
2
votes
2 answers

Creating NSInteger category

When trying to create a category for NSInteger, the compiler complains that it "Cannot find interface declaration for 'NSInteger'". Is it not possible to create an NSInteger category? A simple test will show the compiler error: #import…
Hooligancat
  • 3,588
  • 1
  • 37
  • 55
2
votes
2 answers

using NSInteger in a loop

Do a NSInteger occupies memory? Should we use it in a FOR loop?
Abhinav
  • 37,684
  • 43
  • 191
  • 309
2
votes
1 answer

How do I get the item selected in the UIPickerView with NSIntegerMax?

I'm new to Objective-C, and I already have a button with a function to go when the press the button. In the UIPickerView it has lots of numbers going up until who knows how long. I used this code: -…
Nathan
  • 151
  • 4
  • 16
2
votes
3 answers

NSNumber with if statement in different situations

I know to check whether 2 NSNumbers are the same you need to use ([A isEqualToNumber:B]) instead of (A == B) unlike NSIntegers. However, I have just realized (A == B) works just fine in simulator and I'd like to know why. The stranger thing is…
durazno
  • 559
  • 2
  • 7
  • 25
2
votes
3 answers

Evaluation (NSIntegers) inside if-statement Objective-C

I am in doubt, why this work correctly: NSInteger row = indexPath.row; NSInteger preloadTrigger = self.nodes.count - 20; if (row >= preloadTrigger) { [self.loader loadNextposts]; } And this does not (just skips the if-statement): if…
2
votes
0 answers

NSInteger to Int comparison in the block

What mistake do I have below in the code could you please explain? I have button which has tag property that set 3 and interval also 3, which means 3 == 3 must be true but if is not working. [_busyButtons enumerateObjectsUsingBlock:^(id _Nonnull…
mert
  • 1,090
  • 13
  • 26
2
votes
1 answer

NSNumber with 0 convert to NSInteger/NSUInteger become nil

Why NSNumber of 0 cannot be converted to correct NSInteger/NSUInteger value? NSUInteger a = [@0 unsignedIntegerValue]; // a become nil Why is a in the above line of code nil. Shouldn't it be equal to 0? In the console: (lldb) po [@0…
Alston
  • 1,166
  • 2
  • 13
  • 26