Hi All....
I am doing ping pong game where I have to move ball and detect collision with outside boundary and also with moving paddle. I want to implement it using vector and not by trigonometry.
I am very weak in math,so kindly guide me.
...
I am inserting every row to the UITable view using cellForRowAtIndexPath method. Now I need to always keep the last cell of the table view always selected. i.e. Whenever a new entry is added is should be in selected state and when it is deleted the previous entry of the table view must be in selected state. I tried using selectRowAtIndex...
Hi all,
I'm working on tracking down some difficult to find memory leaks in my iPhone program. I'm running a quick test on an app which leaks an NSString object with the following intentionally -incorrect- code:
-(void)applicationDidFinishLaunching:(NSNotification *)notification;
{
NSMutableString *test = [[NSMutableString alloc] i...
I'm trying to learn how to handle audio at a fairly low level with audio queue services.
I have been progrmaing in memory managed languages for quite a while, and have just completed the c programing tutorial by vtc (2007).
This has left me comfortable with the understanding of pointers and memory allocation, but the apple documention ...
I'm trying to find the size of an objective-c object. I'm using something similar to:
NSLog(@"sizeof myObject: %ld", sizeof(*myObject));
That just gives me the size of the pointer though.
What am I doing wrong?
...
My problem is this: I have a simple block image that I want to make a grid out of. I have created an array of CGPoints in my UIView. Then I used
blackImage = [UIImage imageNamed:@"black.png"];
and then
- (void)drawRect:(CGRect)rect {
for (int j = 0 ; j <= 11; j++)
{
for (int i = 0 ; i <= 7; i++)
{
[blac...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Date formatter for displaying dates
static NSDateFormatter *dateFormatter = nil;
if(dateFormatter == nil){
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterMedium...
New to Objective C so pardon my stupidity,..
I am trying to retrieve my NSIndexSet by calling GetIndexes:MaxCount:IndexRange
Here is my code
const NSUInteger arrayCount = picturesArray.count;
NSUInteger theIndexBuffer[arrayCount];
[picturesArray getIndexes:theIndexBuffer maxCount:arrayCount inIndexRange:nil];
However, in the ...
Hi,
I'm getting this XML response from TwitPic:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
<mediaid>abc123</mediaid>
<mediaurl>http://twitpic.com/abc123</mediaurl>
</rsp>
I want to access the value within the 'mediaurl' tags.
So I tried:
NSString *twitpicURL = [[request responseHeaders] objectForKey:@"m...
I have an NSString with web links in it. I need to find all web links in the string starting with http://. What is the best way to do this?
...
How can I get a float or real value from integer division? For example:
double result = 30/233;
yields zero. I'd like the value with decimal places.
How can I then format so only two decimal places display when used with a string?
...
I have an NSInvocationOperation that would download and parse a series of NSXMLDocuments in the background to my UI responsive.
My attempt at stopping the Invocation operation is to call my NSOperationQueue's cancellAllOperations. But it seems that this won't stop the invocation's execution.
Any ideas on how would I go about this probl...
I have created an NSScrollView in interface builder that has a variable number of semi-unique NSViews that can be programmatically added and removed from it. When I add subViews to the documentView, they appear in the lower-left hand corner instead of the upper-left hand corner. I see that you can check the isFlipped bool to figure out i...
Let's say I have two Entity classes: SocialApp and SocialAppType
In SocialApp I have one Attribute: appURL and one Relationship: type.
In SocialAppType I have three Attributes: baseURL, name and favicon.
The destination of the SocialApp relationship type is a single record in SocialAppType.
As an example, for multiple Flickr accounts...
I have a NSTextField and I want to set its content if I klick on a button and than set the cursor on this textfield at the end of the text so if someone klicks the button he could just begin to type.
Until now I use [NSTextField selectText] it selects this textfield but it selects the whole text so if someone just begins to type he'd lo...
This code is pretty simple, is it correct? I don't know if I should be retaining the delegate passed in via the init method.
@interface SomeClass : NSObject {
SomeClassDelegate *someClassDelegate;
}
-(id)initWithDelegate:(SomeClassDelegate *)delegate;
@end
@implementation SomeClass
-(id)initWithDelegate:(SomeClassDelegate *)delega...
I'd like to be able to set a contact's default image programmatically on the iPhone. Does the API currently allow for that? I've found you can toggle several properties for the person, and create new contacts. I can't seem to find anywhere in the documentation that allows to set a photo.
Thanks!
...
I have code like this:
NSData *data = [NSData dataWithContentsOfURL:objURL];
const void *buffer = [data bytes];
[self _loadData:buffer];
[data release];
the "_loadData" function takes an argument like:
- (void)_loadData:(const char *)data;
How do I convert "const void " to a "const char" on Objective-C?
...
How can I sanitize URLs made from strings to replace characters like space to %20 and etc?
How can I Print a NSURL in NSLog?
How can I send data to a webserver using POST? i know that for HTML GET:
NSURL * theURL = [[NSURL alloc] initWithString:url];
NSString * results = [NSString stringWithContentsOfURL:theURL];
will do the deal, b...
I'm getting the UIImage from the image picker and putting it into a UIImageView. It works fine for regular images, but for images taken with the iphone camera, they sometimes come up rotated 90 degrees.
When accessing one of those images later (it has already been saved to disk) I noticed the above error.
Any ideas? I assume it has som...