Questions tagged "objective-c" (page No.1)

How to make a fetch request for entities that is added in the same day?

My application is an expense list that has entity like this: Expense: date [NSDate] location [NSString] name [NSString] price [float] I'ld like to show the expenses on UITableView group into section by month and later by date of month in another table view (drill down design). NSDate itself includes time so, the results ...

WebView did finish launching does not work

what is wrong with this method? - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { [activityIndicator stopAnimation:self]; } I want to stop the Circular Progress Indicator (activityIndicator). But there is something wrong with - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame. I am coding for mac osx and not for iOS. I heard something from Delegates, what does that mean? ...

UIButton autoresizing woes

Trying to get UIButtons to decrease height but maintain width when device is rotated. Here's code from initWithFrame: of the view that contains the buttons. ParentView.m self = [super initWithFrame:CGRectMake(0, 0, UIKeyboardPortraitHeightPhone, 320)]; self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); self.autoresizesSubviews = YES; // And then on each button I call myButton.frame = myFrame; myButton.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin | ...

allocating UIButton, UITextView etc in UITableViewCell is slow

I have a UITableView which is displaying custom UITableViewCells. I need to display textViews, textFields, buttons, etc in the cells depending upon the use case. My problem is that building these cells the first time is slow. For example a cell which contains a UITextView and two UIButtons takes 33ms ...

Singleton not updating variable immediately

I have a singleton here is the header file: #import <Foundation/Foundation.h> @interface Shared : NSObject { NSString *messages; } @property (nonatomic, retain) NSString *messages; + (Shared*)sharedInstance; @end Here is the implementation: #import "Shared.h" static Shared* sharedInstance; @implementation Shared @synthesize messages; + (Shared*)sharedInstance { if ( !sharedInstance) { ...

Searching An NSArray of NSDictionaries

If I NSLOG() the array that I'm trying to search I get this... ( { id = 101323790; "screen_name" = AmyBurnett34; }, { id = 25073877; "screen_name" = realDonaldTrump; }, { ...

How to change color of NSString in drawAtPoint

I have this chunk of code here that draws a block with a one-character string on it: CGContextDrawImage(context, CGRectMake([blok getLocation].x * xunit, [blok getLocation].y * yunit, 40, 40), [blok getImage].CGImage); [[blok getSymbol] drawAtPoint:CGPointMake([blok getLocation].x * xunit+15, [blok getLocation].y * yunit) withFont:[UIFont fontWithName:@"Helvetica" size:24]]; It's working fine, but I've been doing some layout changes, ...

Objective-C macros - calling a singleton object's method

I'm working with a singleton object/class, and need to call one of its methods frequently, and from many places in a large project. I need define a macro to handle this, but it's not working at the moment. This needs to handle a variable argument list, too. This is what ...

How to i convert a method to a MACRO in objective C

I have this method which basically adds the letters to the contents in an array (demonstration) - (NSMutableArray *) addTheLetterZ:(NSArray *)array { NSMutableArray *addedLetterArray = [[NSMutableArray alloc] init]; [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [addedLetterArray addObject:[NSString ...

How do I set the _kCFStreamPropertyFTPLogInOnly flag in CFFTPStreams?

In a document published by Apple in 2005 (CFFTPStream.c) Reference is made to a property - _kCFStreamPropertyFTPLoginOnly - which does not seem to be published in the current version of CFFTPStream (certainly not in the CFFTPStream.h file on my box) Is there any way of getting the (hidden) property exposed so ...

scale and center calayer to superview

When I scale a layer, the result always has origin set at CGPoint(0,0). What is the best way to make sure after the scale, the layer is still center in its super layer? [CATransaction begin]; [CATransaction setAnimationDuration: 0]; [CATransaction setDisableActions: TRUE]; self.maskLayer.transform = CATransform3DScale(CATransform3DIdentity, .8, .8,1); self.maskLayer.position = CGPointMake(kScreenWidth/2,kScreenHeight/2); [CATransaction commit]; ...

iOS crash log is only partially symbolicated

Here's the issue. I have the .xarchive with all the DSYMs but for whatever reason using symbolicatecrash or xcode is only converting some of the symbols to lines while leaving other ones unconverted. Any ideas? I'm using xCode 4.3.2 on OS X Lion. For example, from a crash log from ...

objective -c delegates syntax query

I am new to objective-c and pretty much confused with the way delegates are used. I came across this code and i would like to use it to clarify some of the doubts. #import <Foundation/Foundation.h> @protocol ProcessDataDelegate <NSObject> @required - (void) processSuccessful: (BOOL)success; @end @interface ClassWithProtocol : NSObject { id <ProcessDataDelegate> delegate; } @property (retain) id delegate; ...

making asynchronous blocks run before other code

I'm trying to fetch a video from the ALAssetLibrary so that I can do stuff with it. I'm using blocks to do it: NSMutableArray *assets = [[NSMutableArray alloc] init]; library = [[ALAssetsLibrary alloc] init]; NSLog(@"library allocated"); // Enumerate just the photos and videos group by using ALAssetsGroupSavedPhotos. [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { ...

Executing method from loaded nib?

I am new in ios development and currently i am having a problem trying to execute a method from a loaded class. HERE IS THE SCENARIO I have a class named "TV_kid", TV_kid will load another class named "Cable_kid" that contain a nib file. That part is not the problem, the issues is ...

Conditional statement on declaring global const variable Objective C

I'm using a private SDK I can only declare one const global variable called const unsigned char KitApplicationKey[]= {0x1b,0 etc.} I would like to check one condition (a bool variable that i save in user default in the appdelagate) and modify the KitApplicationKey depending on the bool value Something like that ...

Crash when pushing from UIViewController to UITableViewController

This is the code for my SearchViewController. But when I push to the nextController, the app crashes and it doesn't reach nextController, or in some cases I get a glance at it before crash. I recieve an error "bad instance sent to selector" in log. The SearchViewController has a NavigationController ...

cocos2d sigleton array is not adding objects

Sorry for my bad english i search over the internet and i saw how to but for some reason is not adding objects; what i want to do is load on a layer my power up sprites and add them on an array and based on the array i will choose which ...

« Previous12345678910 ... 47584759Next »Show All