I have stack category for NSMutableArray that I use in Class A
@implementation NSMutableArray (StackUtil)
- (void)push:(id)stackObject {
[self addObject:stackObject];
}
- (id)pop {
id retVal = [[self lastObject]retain];
[self removeLastObject];
return [retVal autorelease];
}
@end
How do I properly include this category for fo...
I have the following bit of code:
NSData *data = [NSData dataWithContentsOfFile:filePath options:0 error:&fileError];
NSString *recipe = @"";
if (fileError == nil) {
recipe = [NSString stringWithUTF8String:[data bytes]];
NSLog(@"Converted Recipe as: %@",recipe);
NSLog(@"Original Data was: %@",data);
} else {
NSLog(...
Hi,
I am looking for a way for users to select music they want played in the background (from their library) while using my application. Not quite sure how I would implement this feature.
Thanks.
...
I get this random error when I run my app on my iPhone.
First, I tap this method-
-(IBAction)playBeat1 {
NSString *path = [[NSBundle mainBundle] pathForResource:@"beat1" ofType:@"mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[theAudio play];
NSLog...
(I probably didn't phrase that very well!)
I'd like to pass a Class object into an Objective C function:
-(void)someMethod:(Class *)classObject { ...
And, if I want to restrict the parameter to classes who implement a particular protocol, I know I can do this:
-(void)someMethod:(Class<SomeProtocol> *)classObject { ...
But is it po...
I have a NSStatusItem called statusItem created in my AppDelegate. I want to change the tooltip in the instance of NSStatusItem in a different object, but don't know how to do so since I'm still getting the hang of the Objective C language coming from Basic.
How should I implement this?
...
Hello guys!
I would like to show some text with an image. But I would like the text to flow around the image. How can this be done? I've seen I can add views to a label, but I think just adding an image and then text it will not work. Can you point me to the right way please?
Here's the sample image
And thanks again. :)
...
When the MPMoviePlayerViewController is in fullscreen mode on the iPad, it defaults to having its controls to have a previous and next button on the overlay there. In my project I need to capture the click for that overlay button and handle it accordingly. Since I'm not sure how to invoke a playlist just yet there is no next item and cli...
Hi, I am trying to use TouchJSON to retrieve data from a php page with json output. I have followed the same steps as an example project I downloaded from and it still isn't working. When I select the section containing the data from my main menu the app crashes. I am including my view controller implementation file. Thanks, enbr.
http:/...
I am building a media scrobbler. What I want the program to do is to detect the media from iTunes/MPlayer and have the program send an update via API. I got that part down, but when the same Media Title and Segment (track/episode) is compared to this If statement, it does the same action over again, which I don't want the program to do.
...
Setting NSMutableURLRequest with setHTTPMethod:@"HEAD", as i only want the HEAD information, and using NSURLConnection with sendSynchronousRequest, as i need the thread to block until the info is retrieved, all works well until URL redirect occurs. It appears that synchronousRequest uses a GET request after it encounters a redirect and d...
I'm storing text in a sqlite file and setting the text of a UITextView to be the value of that text. The only problem is that the UITextView isn't honoring the newline character. Instead, it's printing it out as text. Here's an example:
Stored in fruit.sqlite and passed to theFruit object:
requiredFruit = "apples\n oranges\n pears"
...
I'm trying to put a button in my iPhone app that will move the user to the appStore and list ALL of our apps.
This wastes time loading safari... then the music store... then the appStore:
itunes.com/apps/OurCompanyName
This tries to load Music Store... and never reaches the app store at all:
itunes.apple.com/us/artist/OurCompa...
Currently, my Iphone application is not released yet. When I worked with the simulator/device and I modify my application to add more cache into the encodeWithCode: and initWithCoder: . The problem is that when the application is loaded, I tried to use some of the encoded object which is not existing before. For example:
In the previous...
HI, everyone,
I want to ask a question about the iPhone application. I am writing a program. The program will ask the user the enter some information and press enter, after that the program will process and get some information, then the program will display the tab page with 3 tabs.
However, I don't know how to switch the page after t...
How do I sort Unicode (foreign) strings in my iPhone application?
...
#import <UIKit/UIKit.h>
@class game;
@class MainMenu;
@interface gameOver : UIViewController {
IBOutlet UIButton *paButton;
IBOutlet UILabel *fScore;
game *playagain;
back *MainMenu;
IBOutlet int hs;
}
@property (nonatomic, retain) UIButton *paButton;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundl...
Hello,
I have the following code:
NSString *text = @"http://bit.ly/111 http://bit.ly/222 http://www.www.www";
NSRegularExpression *aLinkRegex = [NSRegularExpression regularExpressionWithPattern:@".*http://.*" options:NSRegularExpressionCaseInsensitive error:nil];
NSUInteger numberOfMatches = [aLinkRegex numberOfMatchesInString:text opti...
#import "gameOver.h"
#import "MainMenu.h"
@implementation gameOver
@synthesize paButton;
-(IBAction) playAgain
{
playagain = [[game alloc] initWithNibName: @"game" bundle: [NSBundle mainBundle]];
[[self view] addSubview: [playagain view]];
}
-(IBAction) goBack
{
MainMenu = [[back alloc] initWithNibName: @"back" bundle: [NSBundl...
I know in vast of the cases I don't have to release static variable. However the following is the code for my model:
+ (UIImage*)imageForTag
{
static UIImage *imgTag;
if(imgTag == nil)
{
NSString* imageName = [[NSBundle mainBundle]
pathForResource:@"tag" ofType:@"png"];
imgTag = [[...