In cocos2d does anyone know how to center a sprite? Right now, I have a sprite that moves to where you touch on the screen. The problem is that the sprite is aligned to the lower left corner. This means that instead of moving down, if you touch just a little over the bottom the sprite will move up. Thanks in advance!
Here is my code...
...
I've built a custom UI for my table that has a darker UI and a custom accessoryView. When I put the table into editing mode, there is a white line to the left of the reorder control that I can't seem to get rid of.
tableView:accessoryTypeForRowWithIndexPath: doesn't seem to be appropriate for getting rid of it since I'm not using a s...
What are some best practices to keep in mind when working extensively with SQLite on the iPhone? Tips/tricks/convenience factors all appreciated.
...
Does anyone have an example of how to draw the blue "unread dot" used in Apple's Mail App? This one in specific: http://bit.ly/3A7XxD
Drawing an ellipse is straight forward with Quartz2d, but the subtle use of shadows+gradients make this look really 3d.
...
I have a custom view in a custom table cell. Every time a specific property on the custom view is changed I call [self setNeedsDisplay] which redraws the view in - (void)drawRect:(CGRect)rect. That property is set in the table view delegate's tableView:cellForRowAtIndexPath:. But when the table view is larger than the screen and cells ha...
NOTE: I added my new solution at the UPDATE answer below.
I try to recreate the effects we saw in Mobile Safari's tab on iPhone/iPod touch.
Basically, it's a UIScrollView that holds 4 reusable UIView (acting like ring buffer), and scrolls horizontally. When scrolling, the UIView's opacity will fade in/out seamlessly with offset.
Curr...
I have a dictionary of objects; they are all POCO objects that should be serializable. What technique should I look at for writing these to disk. I'm looking for the simplest option to write a few lists to save state.
I think I have 3 options.
plist files. However this seems to be limited to only storing predefined objects (strings...
Hi all,
I am developing a game in which i have to move the ball and power up image simultaneously.
For move a power up image view, I create a separate thread and call move method of power by using [self performSelectorOnMainThread:..], this is required to show the updated position on view. But my Game slowdown after creating this thread...
Please can someone help sort a noob out? I've posted this problem on various forums and received no answers, while many searches for other answers have turned up stackOverflow, so I'm hoping this is the place.
I've got a BeachView.h (subclass of UIScrollView, picture of a sandy beach) covered with a random number of Stone.h (subclass o...
Is there anything currently in the SDK that allows for re-ordering of tableView sections? As in, move the entire section below or above an adjacent section? This is plausible with individual UITableViewCells. Haven't seen it done for sections though.
...
I have a PNG in a UIImageView with alpha around the edges (let's say a circle). When I tap it, I want it to register as a tap for the circle if I'm touching the opaque bit, but a tap for the view behind if I touch the transparent bit.
(BTW: On another forum, someone said PNGs automatically do this, and a transparent PNG should pass the...
Dear All,
I'm currently learning Iphone programing and I'm having some trouble wrapping my mind around CAKeyframeAnimation
I'm using CAKeyframeAnimation to animate objects on the screen like so:
CGPathMoveToPoint(thePath, NULL, start.x, start.y);
CGPathAddLineToPoint(thePath, NULL, finish.x, finish.y);
animation.path = thePath;
anima...
Hi all,
I'm taking a look at this widget, and it appears to be a UIPickerView, however I haven't seen anything provided by the iPhone SDK API that allows for horizontal scrolling only. Mostly it's all done vertically. Also there appears to be a custom graphic around this picker, so it might not be that either.
I'm curious if anyone is ...
Hello,
first of all, sorry if that question is dumb but I´m a total newbie in ObjC.
In my iPhone Application, I have an CLLocationManager implementation in my one and only ViewController because I have only one View. No I want more Views in my Application and every View needs the Position Information from the CLLocationmanager.
So, I ...
When configuring a Settings.bundle as part of an iPhone application bundle, it's trivial to add minimum and maximum value images to sliders (PSSliderSpecifier), but not simple maximum and minimum text labels.
http://developer.apple.com/iPhone/library/documentation/PreferenceSettings/Conceptual/SettingsApplicationSchemaReference/Articles...
I have a UITableView that has a disclosure button on every row. When the table is put into edit mode and the the Deletion control is pressed ("-" sign), the Delete Button shows, however the disclosure button is not replaced, but instead just slides to the left of the delete button.
The apple UITableView guide explains the delegates for...
Hi,
I have this line of code (splits is an instance variable):
splits = [[NSMutableArray alloc] initWithObjects:[NSMutableArray array]];
This code is obviously wrong (it should be nil-terminated), however it runs fine in the simulator, even though it throws an EXC_BAD_ACCESS on the device. My question is why does the simulator not th...
When I programmatically allocated a UILabel in my custom initWithNibName method, and later in viewDidLoad, tried to assign a string to it, the label was not pointing to anything. I didn't release it; the label shows on the screen. If I create the label in IB, and assign text to it in viewDidLoad, it works.
Is it against a rule to set up...
During my performance tests I found out the the SQLite version which Apple provides on the iPhone 3.0 is significantly faster then my self compiled amalgamation SQLite version. So my question is, is there a way to find out which compilation options Apple did use?
Is there a test app which prints out all the default set pragams and sqlit...
There seems to be an delegate that can be set like myView.layer.delegate = anObject
The documentation just says:
delegate
Specifies the receiver’s
delegate object.
@property(assign) id
delegate
I wonder what kind of methods that delegate would implement, and when they would be called. Could solve some big problems ...