i have performed like this Is there any thing wrong performed by me?
NSURL *url = [NSURL URLWithString:@"http://111.111.111.111/BattleEmpire.Service/ApplicationService.svc?wsdl"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
[theRequest setHTTPMethod:@"GET"];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if(theConnection)
{
webData = [[NSMutableData data] retain];
NSLog( @"connection established");
}
else {
NSLog(@"theConnection is NULL");
}
Hi i am developing an app for my QA department. I need to programically get how many phone numbers are there in the entire address book. No user input. Just click a button and then get how many phonenumbers are there in the ENTIRE addressbook.
Please email me at [email protected]
I have a simple UITableView setup. I am trying to use
- (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item
I put a NSLog inside this method, but it is apparently not getting called when I "pop" back to the screen. I am not finding much information about this function, has it been replaced?
I have views that can be rotated, scaled and moved around the screen. I want the view to resize and be orthogonal when the user double tap's the view to edit the textview within.
The code is below.
Somewhere the transform is getting reset. The NSLog statement below prints the identity transform, but a print of the transform when the animation is complete in transitionDidStop reveals that the transform is what it was before I thought I set it to identity. The view resizes, but it acts like the transform was never set to identity?
Any ideas/pointers?
originalBounds = self.bounds;
originalCenter = self.center;
originalTransform = self.transform;
r = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 70, 450);
[UIView beginAnimations: nil context: NULL];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(transitionDidStop:finished:context:)];
self.transform = CGAffineTransformIdentity;
NSLog(@"%@ after set", NSStringFromCGAffineTransform([self transform]));
[self setBounds: r];
[self setCenter: p];
[self setAlpha: 1.0];
[UIView commitAnimations];
[textView becomeFirstResponder];
I notice that this method is provided in UIViewController .m files, but is commented out:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
I had been leaving that method commented out, or even deleting it. But then I looked at this line inside the method:
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
I assume that if it were truly important for self to be set equal to super, then Apple would not have the method be commented out by default. On the other hand, if I do need to do some customization in that method, why do I need to set self = super? What's the best practice, and why?
This should be so simple, and yet, it is evading me: When stopped at a breakpoint in the Xcode/gdb debugger, I wish to find the current refcount of an object derived from NSObject. How can I do this? I can't seem to find a way, and it is driving me mad.
Hello friends,
I have Text(http://www.mywebsite.com) in a view, in which i need to provide URL link, so that clicking on that one will take user to the browser.
How do i achieve it? Please provide your suggestions.
Thank you very much.
I am developing an app and I have encountered a problem that comes down to this scenario:
Consider a superview with two buttons(button1,button2) and a text view, all as its subviews. When I click on one button, I display the text view. When I tap on anywhere outside the textview, but in the super view, I need to dismiss the text view.
I have added a UITapGestureRecognizer to the super view and it calls a method tap:. In tap:, I get the point of the tap and if it is outside the text view, I dismiss the text view and remove the GestureRecognizer. Now the problem occurs when I tap on button 2. I need to dismiss the text view as well as execute the action for button 2. But it enters tap: and I do not wish to call the button 2's method from there.
What I want to know is if it would be possible to emulate the same tap at the same co ordinates after the gesture recognizer is removed? If not what is the way I proceed to solve this issue?
Been working on this problem of collision detection and there appears to be 3 main approaches I could take:
Sprite and mask approach. (AND the overlap of the sprites and check for a non-zero number in the resulting sprite pixel data).
Bounding circles, rectangles or polygons. (Create one or more shapes that enclose the sprites and do the basic maths to check for overlaps).
Use an existing sprite library.
The first approach, even though it would have been the way I would have done it in the old days of 16x16 sprite blocks, it appears that there just isn’t an easy way of getting at the individual image pixel data and/or alpha channel within Quartz (or OPENGL for that matter). Detecting the overlap of the bounding box is easy, but then creating a 3rd image from the overlap and then testing it for pixels is complicated and my gut feel is that even if we could get it to work would be slow. Am I missing something neat here?
The second approach involves dividing up our sprites into several polygons and testing them for overlaps. The more polygons the more accurate the collision detection. The benefit is that it is fast, and can be accurate. The downside is it makes the sprite creation more complicated. i.e., we have to create the polygons for each sprite. For speed the best approach is to create a tree of polygons.
The 3rd approach I’m not sure about as it involves buying code (or using an open source licence). I am not sure what the best library to use is or whether this would make life easier or give us a problem integrating this into our app.
So in short I am favouring the polygon and tree approach and would appreciate you views on this before I go and write lots of code.
Best regards
Dave
I'm writing a freeware version of an app and would like to check if a user already has the unfree version installed, and print a message whose contents are conditional on the results of the installation check... anybody know if this is possible?
the closest I've come to a solution is to make use of the CFPreferencesSetValue API with a kCFPreferencesAnyUser / kCFPreferencesCurrentHost pairing... I haven't tried it, but based on the documentation it sounds possible.
however in my current specific situation this API will not be able to solve my problem, because I want to check for the presence of an app I wrote 4 months ago that didn't write any data to the CFPrefs registry... because back then I didn't know of it nor did I foresee this situation arising... the only way CFPrefs can assist me is in future apps now that I know it exists :)
so I'm wondering if there are other ways to do it? any help will be appreciated :)
In my application, there is one button in the navigation bar. I want it to work only for the 1t click of the user. If he continousally presses on it 2 or 3 times just after the 1st click the button shouldnt recieve the following ones. How can I do this?
My app always crashes if the user presses it for more than once. I dont want to make it multithread and use lock. Thats why i want to know whether there is anyother alternative.
I read somewhere that in a programmatically created view in a UIViewController, not using Interface Builder, -viewDidLoad and -viewDidUnload should not be used. Is this right? Why? Where would I release subviews that I have retaining properties of? Or should I just not use properties for them?
EDIT: Read my comments on Rob Napier's answer.
I have a detail view in a table view.
Every thing working ok, and I can go to the detail view and back to the table view.
The problem is that the Back button on the navbar is working but i cant see it..
I cant figure why, and what to do..
I need it there.
Thanks.
I would like to animate a page flipping, like is shown here, but without using the built-in UIViewAnimationTransitionCurlUp and UIViewAnimationTransitionCurlDown animations. Is that possible?
Hi there,
Compiling my application works—everything is fine. The only errors I get are by deprecated functions (setText).
The only problem is now, is that when I tap on a cell in my table, the app crashes, even though it's meant to push to the next view in the stack.
Any solutions are appreciated, if you need any code, just ask.
Also, how can I only make sure that one cell goes to only one view? For example:
When I tap on CSS, it takes me to a new table with different levels of CSS. WHen I tap on an item in that new view, it comes up with an article on what I just selected.
Regards,
Jack
To me, this looks like a UITableViewCell, but with rounded corners. I also want the behavior of my "button" to do behave the same way as in the timer App. How do I do it?
Hi,
I want to change an activity indicator color gray/white to black color. Is it possible to change the color to Black?. If yes, Please guide me or give some sample code.
Thanks in Advance.
Hey guys,
I want to use custom url schemes in my app, for example calling navigons mobile navigator.
First of all I want to check whether navigon is installed or at least whether the custom url scheme "navigon://" has already been registered.
Any Ideas?
Thanks a lot.
I can have a UIWebView with the .m3u file opened, which will go to the webview with a play button displayed, and that automatically goes to the quicktime player and starts playing the stream. But when I press the done button, it goes back to the UIWebView with a little play button in the middle, and from there you can go back to the previous screen (it was selected from a tableview). So I just want it to automatically load the quicktime player in the view. How can I do that?
According to the rules of memory management in a non garbage collected world, one is not supposed to retain a the calling object in a delegate. Scenario goes like this:
I have a class that inherits from UITableViewController and contains a search bar. I run expensive search operations in a secondary thread. This is all done with an NSOperationQueue and subclasses NSOperation instances. I pass the controller as a delegate that adheres to a callback protocol into the NSOperation.
There are edge cases when the application crashes because once an item is selected from the UITableViewController, I dismiss it and thus its retain count goes to 0 and dealloc gets invoked on it. The delegate didn't get to send its message in time as the results are being passed at about the same time the dealloc happens.
Should I design this differently? Should I call retain on my controller from the delegate to ensure it exists until the NSOperation itself is dealloc'd? Will this cause a memory leak? Right now if I put a retain on the controller, the crashes goes away. I don't want to leak memory though and need to understand if there are cases where retaining the delegate makes sense.
Just to recap.
UITableViewController creates an NSOperationQueue and NSOperation that gets embedded into the queue. The UITableViewController passes itself as a delegate to NSOperation. NSOperation calls a method on UITableViewController when it's ready. If I retain the UITableViewController, I guarantee it's there, but I'm not sure if I'm leaking memory. If I only use an assign property, edge cases occur where the UITableViewController gets dealloc'd and objc_msgSend() gets called on an object that doesn't exist in memory and a crash is imminent.