Tag: objective c

Are classes objects in Objective-C?

okay, so I understand that an object is an instance of a class that must be allocated and initialized, but are classes themselves objects? I know when you create a new class it is an instance of something else, like NSObject. So, if this makes it a class, then objects can hold not only variables […]

Push-Notification Badge auto increment

I’ve been implementing the push service to my application, and I’ve been thinking about the application’s badge. My app is a mail app (sorta) and I want to notify the user via push for new messages added to the inbox, I want the badge = number of new messages in the inbox. I thought of […]

How to get the width of an NSString?

I am trying to get the width of an NSString (ex. NSString *myString = @”hello”). Is there a way to do this? Thanks.

How to create global functions in Objective-C

I’m developing an iphone app and I need to have some functions to use globally in my classes. But how can I do this? I just tried to create functions.h likes this #include <Foundation/Foundation.h> – (void)printTest; and in the functions.m #import “functions.h” – (void)prinTest { NSLog(@”test”); } but it doesn’t work. Says me: “Method definition […]

UISlider to control AVAudioPlayer

I’m trying to implement a little function in my app. I am currently playing sounds as AVAudioPlayers and that works fine. What I would like to add is to control the sound’s position (currentTime) with an UISlider: is there a simple way to do it ? I looked at an Apple project but it was […]

Shift hue of an RGB Color

I’m trying to write a function to shift the hue of an RGB color. Specifically I’m using it in an iOS app, but the math is universal. The graph below shows how the R, G, and B values change with respect to the hue. Looking at that it seems like it should be a relatively […]

How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?

This question is about iOS device rotation and multiple controlled views in a UINavigationController. Some views should be constrained to portrait orientation, and some should autorotate freely. If you try and create the simplest setup with three views, you’ll notice that the autorotation behavior has a few very nasty quirks. The scenario is, however, very […]

Objective C calling method dynamically with a string

Im just wondering whether there is a way to call a method where i build the name of the method on the fly with a string. e.g. I have a method called loaddata -(void)loadData; to call this i would normally call it like [self loadData]; But i want to be able to call it dynamically […]

How to Implement iOS8 Interactive Notification

I am developing an iOS8 application which supports interactive notification. But I don’t have clarity on the features supported by interactive notification and how to send/handle interactive notifications. If any one can give an example, that would be very much helpful for me. Thanks in Advance 🙂

Storing and retrieving unsigned long long value to/from NSString

I have an unsigned long long value which I want to store into an NSString and retrieve from the string. Initially I have the value in an NSNumber and I am using this to get the string NSString *numStr = [NSString stringWithFormat:@”%llu”, [myNum unsignedLongLongValue]]; where myNum is an NSNumber. To get back the NSNumber from […]