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
2
votes
1 answer

NSInteger multiplication: Invalid operands to binary expression

I try to multiply two NSIntegers, but Xcode gives me an error: NSInteger singlePage = ((NSInteger)floor((scrollView.contentOffset.x * 2.0f + pageWidth) / (pageWidth * 2.0f))); NSInteger page = singlePage * visiblePages; And the error itself: …
Richard Topchii
  • 7,075
  • 8
  • 48
  • 115
2
votes
3 answers

Using multiple times appDelegate in the same UIViewController

I am new to objective-C and cocoa. In my UIViewController I need to access AppDelegate multiple times in different methods A. Is calling in every method: AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; consumes more…
Dejell
  • 13,947
  • 40
  • 146
  • 229
2
votes
5 answers

Obtaining float from division between NSIntegers

I have two NSInteger variables called "domande" and "corrette". I have to execute this operation with them: corrette*10/domande. I want the result to be a float variable, so I declared a "voto" variable as so: "float voto = corrette*10/domande;" .…
BigCola
  • 312
  • 1
  • 4
  • 16
2
votes
3 answers

Bad Receiver type 'NSInteger' (aka 'int')

int thumbCount = [_totalThumbs thumbsViewNumberOfThumbs:self]; _totalThumbs is a NSInteger type property. thumbsViewNumberOfThumbs is a method of type NSInteger. I need to get the count in 'int' itself so that i can use it for further…
iCodes
  • 1,382
  • 3
  • 21
  • 47
2
votes
2 answers

Convert NSInteger to bytes

I want construct a NSData object that contents 3 NSInteger type, and I do with follow codes: - (void)test { NSInteger i = 12, j = 2000, k = 2; NSMutableData *md = [NSMutableData dataWithCapacity:10]; [md appendBytes:&i…
DJean
  • 334
  • 3
  • 15
2
votes
2 answers

Make UIStepper increase increment by 5

Is there a way to make a UIStepper count by 5's rather than a single increment at a time? i.e, tap + and a label says 5, 10, 15, 20, etc. or subtract by 5 every time? So far I have tried value +5; and that doesn't work. Any help is gladly…
2
votes
4 answers

Using MPMediaPlaylistPropertyPlaylistAttributes and bitwise operators on NSInteger- Objective C (iPhone)

and thanks in advance for you time. I am trying to filter out certain types of playlists for an iphone app (genius and On-the-go, specifically). the documentation says that the property attribute MPMediaPlaylistPropertyPlaylistAttributes will return…
Mr200 Backstrok
2
votes
4 answers

Xcode iPhone SDK - Keep NSInteger zero at beginning

I want to keep the zero at the beginning of my NSInteger, but when i NSLog it, the zero is removed. NSInteger myInteger = 05; NSLog("%d", myInteger); log: 5 I get 5 instead of 05. How can i keep the 0 at the beginning of the integer?
Aleksander Azizi
  • 9,829
  • 9
  • 59
  • 87
1
vote
2 answers

How to convert an NSDictionary value to NSInteger

I m a noob what i want is to convert a NSDictionary object to NSInteger.i m parsing json objects and storing it in an NSMutableArray,which is then stored in NSDictionary object called boy.could you guys help me out.below is the code. …
stephensam
  • 91
  • 3
  • 12
1
vote
3 answers

NSInteger always zero

I have a NSInteger which always returns zero :( I have it declared like: NSInteger level; @property(nonatomic, assign) NSInteger level; The synthetize: @synthesize fileName, filePath, theActualIndexPath, titleBar, level; Then when using…
pmerino
  • 5,900
  • 11
  • 57
  • 76
1
vote
2 answers

NSInteger and int giving exceptions

I'm trying to get data from a database using FMDB but having tried with futility for a while, I can't figure out why this is throwing an EXC_BAD_ACCESS exception. The parameter is passed in from an NSInteger, but I can neither log it nor use it in a…
Echilon
  • 10,064
  • 33
  • 131
  • 217
1
vote
1 answer

how to use uistepper to multiply value from segue data transfer

So I came across this question that relates to mine and I was wondering how I can do this with a value from a segue data transfer. I want to be able to use my data transfer value as the original value and only have that value change if the stepper…
dsonawave
  • 137
  • 2
  • 12
1
vote
1 answer

Arithmetic operation of value that exceeds limit in objective c

I have been trying the question on hacker rank in which addition of all the substring of a string is taken into account. In doing so our answer exceeds the limit of NSInteger, NSUInteger, long, very very long, double. So in this case i tried -…
Himan Dhawan
  • 894
  • 5
  • 23
1
vote
2 answers

use if with NSinteger?

I WANT to use NSinteger variable *strength in my code with if condition but it's not work.. :( if(strength == 11){ } How can i use if with NSInteger*
The deals dealer
  • 1,006
  • 2
  • 8
  • 16
1
vote
2 answers

Assemble date object from integers?

Given three integers, representing a day, month and year, what code would assemble those integers into a date object?
Moshe
  • 57,511
  • 78
  • 272
  • 425