I have a UIModalPresentationFullScreen but my UI elements are not showing up properly. I want to define the screensize in IB, but I'm not sure what the size should be?
-(void)loadWebAdress:(NSString*)textAdress {
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
adressurl=[NSString stringWithFormat:@"http://%@", textAdress];
NSURL *url=[NSURL URLWithString:adressurl];
NSURLRequest *requestObj=[NSURLRequest requestWithURL:url];
[webview loadRequest:requestObj];
}
although url takes it's value from adressurl, adressurl is all the time out of scope when checked in debugger. what is going on? i would like to use it in some other places too. not only in this method. because is out of scope, the app crashes. But, I repeat, it is the one who gives its value to url.
I want to unit test the custom init method of a class that inherits from NSURLConnection -- how would I do this if the init of my testable class invokes NSURLConnection's initWithRequest?
I'm using OCMock and normally, I can mock objects that are contained within my test class. For this inheritance scenario, what's the best approach to do this?
- (void)testInit
{
id urlRequest = [OCMockObject mockForClass:[NSURLRequest class]];
MyURLConnectionWrapper *conn = [[MyURLConnectionWrapper alloc]
initWithRequest:urlRequest delegate:self
someData:extraneousData];
}
My class is implemented like this:
@interface MyURLConnectionWrapper : NSURLConnection {
}
- (id)initWithRequest:(NSURLRequest *)request
delegate:(id)delegate someData:(NSString *)fooData
@end
@implementation MyURLConnectionWrapper
- (id)initWithRequest:(NSURLRequest *)request
delegate:(id)delegate someData:(NSString *)fooData
{
if (self = [super initWithRequest:request delegate:delegate])
{
// do some additional work here
}
return self;
}
Here's the error I get:
OCMockObject[NSURLRequest]: unexpected
method invoked: _CFURLRequest
I keep getting 'warning: control reaches end of non-void function' with this code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section ==0)
{
return [comparativeList count];
}
if (section==1)
{
return [generalList count];
}
if (section==2)
{
return [contactList count];
How can I get rid of this warning?
Thanks.
Hi,
I am looking for a way to get a twitter users userid via their username.
For example take http://twitter.com/AlySSa_miLAno (yes I know her twitter page off by heart lol) on the right hand side of the page is a link to her RSS feed:
feed://twitter.com/statuses/user_timeline/26642006.rss
In this context Alyssa's userid would be 26642006.
Ideally I would like to avoid reading the full content of the page, as this could be quite expensive on a mobile device, so if anyone knows how to accomplish this using any Twitter/3rd party webservices that would be great.
I am just curious, is there a way to print via NSLog the contents of a struct?
id <MKAnnotation> mp = [annotationView annotation];
MKCoordinateRegion region =
MKCoordinateRegionMakeWithDistance([mp coordinate], 350, 350);
I am trying to output whats in [mp coordinate] for debugging.
.
EDIT_001:
I cracked it, well unless there is another way.
id <MKAnnotation> mp = [annotationView annotation];
CLLocationCoordinate2D location = [mp coordinate];
NSLog(@"LAT: %f LON: %f", location.latitude, location.longitude);
many thanks
gary
Hello all working on my building my first iDevice app and I am trying to populate a UITableView with data from json result I can get it to load from plist array no propblem and I can even see my json the problem I'm having is that the UITableView never gets to see the json results please bare with me as this is first time with obj-c or anything like it
in my .h file
@interface TableViewViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
NSArray *exercises;
NSMutableData *responseData;
}
in my .m file
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return exercises.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//create a cell
UITableViewCell *cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"cell"];
// fill it with contnets
cell.textLabel.text = [exercises objectAtIndex:indexPath.row];
// return it
return cell;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
responseData = [[NSMutableData data] retain];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://url_to_json"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self ];
// load from plist
//NSString *myfile = [[NSBundle mainBundle] pathForResource:@"exercise" ofType:@"plist"];
//exercises = [[NSArray alloc] initWithContentsOfFile:myfile];
[super viewDidLoad];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[responseData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[responseData appendData:data];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"Connection failed: %@", [error description]);
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
[responseData release];
NSDictionary *dictionary = [responseString JSONValue];
NSArray *response = [dictionary objectForKey:@"response"];
exercises = [[NSArray alloc] initWithArray:response];
}
I'm trying to use NSXmlParser to parse ISO-8859-1 data. Using Apple's own example for parsing ISO-8859-1, I have the following.
NSString *xmlFilePath = [[NSBundle mainBundle] pathForResource:sampleFileName ofType:@"xml"];
NSString *xmlFileContents = [NSString stringWithContentsOfFile:xmlFilePath encoding:NSISOLatin1StringEncoding error:nil];
NSLog(@"contents: %@", xmlFileContents);
I see that in the console, the contents of the string is accurate.
However when I try to convert it to an NSData object (for use with the parser), I do the following.
NSData *xmlData = [xmlFileContents dataUsingEncoding:NSISOLatin1StringEncoding];
But then when my didStartElement delegate gets called, I see  showing up which I think is from an encoding discrepancy.
Can NSXmlParser handle ISO-8859-1 and if so, what am I doing wrong?
I have a TableView controller class that uses a fetched results controller to display a list of 'patient' entities taken from a Core Data model. The sections of this table are taken from a patient attribute called 'location'. Here is the sort descriptor for the fetch request:
NSSortDescriptor *locationDescriptor = [[NSSortDescriptor alloc] initWithKey:@"location" ascending:YES];
NSSortDescriptor *lastNameDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastName" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:locationDescriptor, lastNameDescriptor, nil];
Here is the initialisation code for the FRC:
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"location" cacheName:@"List"];
When I want to add a new 'patient' entity - I click an add button which then pushes an 'add new patient' view controller to the navigation stack.
The first patient I add works fine.
If I add a second patient - the app will sometimes crash with the following error:
2010-03-22 14:42:05.270 Patients[1126:207] Serious application error. Exception was caught during Core Data change processing: * -[NSCFArray insertObject:atIndex:]: index (1) beyond bounds (1) with userInfo (null)
2010-03-22 14:42:05.272 Patients[1126:207] Terminating app due to uncaught exception 'NSRangeException', reason: '** -[NSCFArray insertObject:atIndex:]: index (1) beyond bounds (1)'
This only seems to happen if the patient's have a location added (if none is added then the location defaults to 'unknown'). It seems to have something to do with the sorting of the location too. For instance, if the first patient location = ward 14 and the second = ward 9 then it crashes without fail.
I'm wondering if this is something to do with how I am asking the fetched results controller to sort the section names??
This bug is driving me nuts and I just can't figure it out. Any help would be greatly appreciated!
I'm trying to add images to table cells in a grouped UITableView but the corners of the images are not clipped. What's the best way to go about clipping these (besides clipping them in Photoshop? The table contents are dynamic.)
Does anyone have a GKVoiceChat example for the iPhone SDK in 4.0 or later? I would really appreciate it if they could share it with me. It will surely help with my iphone game.
Sincerely,
Kevin
I needs to show messages which are available in history. I mean messages that are present in iphone.
I try from google but no any appropriate help.
Is there no any way to retrive it from iphone ?
or is there any alternative way ? Please mention that i just needs the history of messages.
I have an app where my main view accepts both touchesBegan and touchesMoved, and therefore takes in single finger touches, and drags. I want to implement a UIScrollView, and I have it working, but it overrides the drags, and therefore my contentView never receives them. I'd like to implement a UIScrollview, where a two finger drag indicates a scroll, and a one finger drag event gets passed to my content view, so it performs normally. Do I need create my own subclass of UIScrollView?
Here's my code from my appDelegate where I implement the UIScrollView.
@implementation MusicGridAppDelegate
@synthesize window;
@synthesize viewController;
@synthesize scrollView;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
//[application setStatusBarHidden:YES animated:NO];
//[window addSubview:viewController.view];
scrollView.contentSize = CGSizeMake(720, 480);
scrollView.showsHorizontalScrollIndicator = YES;
scrollView.showsVerticalScrollIndicator = YES;
scrollView.delegate = self;
[scrollView addSubview:viewController.view];
[window makeKeyAndVisible];
}
- (void)dealloc {
[viewController release];
[scrollView release];
[window release];
[super dealloc];
}
Hello,
I'm attempting to load data from an undocumented API (OsiriX).
Getting the NSManagedObject like this:
NSManagedObject *itemStudy = [[BrowserController databaseOutline] itemAtRow: [[BrowserController databaseOutline] selectedRow]];
works just fine.
But getting the NSManagedObject like this:
seriesArray = [_context executeFetchRequest:request error:&error];
NSManagedObject *itemSeries = [seriesArray objectAtIndex:0];
Generates an error when I call [itemSeries valueForKey:@"type"]
2010-05-27 11:04:48.178 rcOsirix[27712:7b03] Exception: [<NSManagedObject 0xd30fd0> valueForUndefinedKey:]: the entity Series is not key value coding-compliant for the key "type".
This confuses me thoroughly. If I print the KVC values for itemSeries I get this list:
2010-05-27 11:04:48.167 rcOsirix[27712:7b03] KVC comment
2010-05-27 11:04:48.168 rcOsirix[27712:7b03] KVC date
2010-05-27 11:04:48.168 rcOsirix[27712:7b03] KVC dateAdded
2010-05-27 11:04:48.169 rcOsirix[27712:7b03] KVC dateOpened
2010-05-27 11:04:48.169 rcOsirix[27712:7b03] KVC displayStyle
2010-05-27 11:04:48.170 rcOsirix[27712:7b03] KVC id
2010-05-27 11:04:48.170 rcOsirix[27712:7b03] KVC modality
2010-05-27 11:04:48.170 rcOsirix[27712:7b03] KVC name
2010-05-27 11:04:48.171 rcOsirix[27712:7b03] KVC numberOfImages
2010-05-27 11:04:48.171 rcOsirix[27712:7b03] KVC numberOfKeyImages
2010-05-27 11:04:48.171 rcOsirix[27712:7b03] KVC rotationAngle
2010-05-27 11:04:48.172 rcOsirix[27712:7b03] KVC scale
2010-05-27 11:04:48.172 rcOsirix[27712:7b03] KVC seriesDICOMUID
2010-05-27 11:04:48.173 rcOsirix[27712:7b03] KVC seriesDescription
2010-05-27 11:04:48.173 rcOsirix[27712:7b03] KVC seriesInstanceUID
2010-05-27 11:04:48.173 rcOsirix[27712:7b03] KVC seriesSOPClassUID
2010-05-27 11:04:48.174 rcOsirix[27712:7b03] KVC stateText
2010-05-27 11:04:48.174 rcOsirix[27712:7b03] KVC thumbnail
2010-05-27 11:04:48.174 rcOsirix[27712:7b03] KVC windowLevel
2010-05-27 11:04:48.175 rcOsirix[27712:7b03] KVC windowWidth
2010-05-27 11:04:48.175 rcOsirix[27712:7b03] KVC xFlipped
2010-05-27 11:04:48.176 rcOsirix[27712:7b03] KVC xOffset
2010-05-27 11:04:48.176 rcOsirix[27712:7b03] KVC yFlipped
2010-05-27 11:04:48.176 rcOsirix[27712:7b03] KVC yOffset
2010-05-27 11:04:48.177 rcOsirix[27712:7b03] KVC mountedVolume
2010-05-27 11:04:48.177 rcOsirix[27712:7b03] KVC study
2010-05-27 11:04:48.178 rcOsirix[27712:7b03] KVC images
The KVC for itemStudy is this:
2010-05-27 10:46:40.336 OsiriX[27266:a0f] KVC accessionNumber
2010-05-27 10:46:40.336 OsiriX[27266:a0f] KVC comment
2010-05-27 10:46:40.336 OsiriX[27266:a0f] KVC date
2010-05-27 10:46:40.336 OsiriX[27266:a0f] KVC dateAdded
2010-05-27 10:46:40.336 OsiriX[27266:a0f] KVC dateOfBirth
2010-05-27 10:46:40.336 OsiriX[27266:a0f] KVC dateOpened
2010-05-27 10:46:40.337 OsiriX[27266:a0f] KVC dictateURL
2010-05-27 10:46:40.337 OsiriX[27266:a0f] KVC expanded
2010-05-27 10:46:40.337 OsiriX[27266:a0f] KVC hasDICOM
2010-05-27 10:46:40.337 OsiriX[27266:a0f] KVC id
2010-05-27 10:46:40.337 OsiriX[27266:a0f] KVC institutionName
2010-05-27 10:46:40.337 OsiriX[27266:a0f] KVC lockedStudy
2010-05-27 10:46:40.337 OsiriX[27266:a0f] KVC modality
2010-05-27 10:46:40.338 OsiriX[27266:a0f] KVC name
2010-05-27 10:46:40.338 OsiriX[27266:a0f] KVC numberOfImages
2010-05-27 10:46:40.338 OsiriX[27266:a0f] KVC patientID
2010-05-27 10:46:40.338 OsiriX[27266:a0f] KVC patientSex
2010-05-27 10:46:40.338 OsiriX[27266:a0f] KVC patientUID
2010-05-27 10:46:40.338 OsiriX[27266:a0f] KVC performingPhysician
2010-05-27 10:46:40.339 OsiriX[27266:a0f] KVC referringPhysician
2010-05-27 10:46:40.339 OsiriX[27266:a0f] KVC reportURL
2010-05-27 10:46:40.339 OsiriX[27266:a0f] KVC stateText
2010-05-27 10:46:40.339 OsiriX[27266:a0f] KVC studyInstanceUID
2010-05-27 10:46:40.339 OsiriX[27266:a0f] KVC studyName
2010-05-27 10:46:40.339 OsiriX[27266:a0f] KVC windowsState
2010-05-27 10:46:40.339 OsiriX[27266:a0f] KVC albums
2010-05-27 10:46:40.340 OsiriX[27266:a0f] KVC series
If I use code:
NSDictionary *props = [[item entity] propertiesByName];
for (NSString *s in [props allKeys]) {
NSLog(@"KVC %@", s);
}
Yet itemStudy throws no error if I call [itemStudy valueForKey:@"type"] when it should because there's no KVC for @"type"!!!
Granted, the objects are different but neither of them contain the key @"type" and they both should throw errors, yet the Osirix code Tests for both conditions:
if ([[item valueForKey:@"type"] isEqualToString:@"Series"]) {
...
}
if ([[item valueForKey:@"type"] isEqualToString:@"Study"]) {
...
}
And throws no errors. Yet when I load an NSManagedObject of the same exact model and entity @"Series" it throws the 'no key value' when passed into the conditions above.
Am I missing something? Both the superentity and subentities of itemSeries and itemStudy are nil so they don't inherit from something that has KVC @"type".
I'm totally at a loss as to explain what is going on.
--- EDIT ---
I know no one can explain what is going on... but maybe where to start looking? How would itemStudy have the extra KVC @"type" that doesn't show up in it's property list?
Thank you for your assistance,
-Stephen
I have some data like this :
1, 111, 2, 333, 45, 67, 322, 4445
NSArray *array = [[myData allKeys]sortedArrayUsingSelector: @selector(compare:)];
If I run this code, it sorted like this:
1, 111, 2,322, 333, 4445, 45, 67,
but I actually want this:
1, 2, 45, 67, 111, 322, 333, 4445
How can I implement it? thz u.
Does somebody else has randomly seen crashes in ASIInputStream forwardInvocation: during the use of ASIFormDataRequest? (the request was startAsynchronous)
Here is the backtrace:
#0 0x95877b83 in CFRunLoopSourceSignal ()
#1 0x958daa45 in _CFStreamScheduleWithRunLoop ()
#2 0x9588d05d in __invoking___ ()
#3 0x9588cfc8 in -[NSInvocation invoke] ()
#4 0x958c8f28 in -[NSInvocation invokeWithTarget:] ()
#5 0x0001d7ee in -[ASIInputStream forwardInvocation:] (self=0x228d40, _cmd=0x972d80c0, anInvocation=0x225a70) at /Users/catlan/Projekte/TBU/ASIInputStream.m:75
#6 0x9588de54 in ___forwarding___ ()
#7 0x9588d982 in __forwarding_prep_0___ ()
#8 0x958da8f8 in CFReadStreamScheduleWithRunLoop ()
#9 0x958daa26 in _CFStreamScheduleWithRunLoop ()
#10 0x958daa26 in _CFStreamScheduleWithRunLoop ()
#11 0x00015d4d in -[ASIHTTPRequest scheduleReadStream] (self=0x2318e0, _cmd=0x23490) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:2608
#12 0x0000de97 in -[ASIHTTPRequest startRequest] (self=0x2318e0, _cmd=0x23827) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:1005
#13 0x0000b56c in -[ASIHTTPRequest main] (self=0x2318e0, _cmd=0x973cfd56) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:624
#14 0x0000b0a8 in -[ASIHTTPRequest startAsynchronous] (self=0x2318e0, _cmd=0x2136e) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:546
#15 0x00004b0f in -[TBUploadWindowController requestUserInfo] (self=0x2f09e10, _cmd=0x205ed) at /Users/catlan/Projekte/TBU/TBUploadWindowController.m:119
#16 0x92591ad9 in __NSFireDelayedPerform ()
#17 0x95851edb in __CFRunLoopRun ()
#18 0x9584f864 in CFRunLoopRunSpecific ()
#19 0x9584f691 in CFRunLoopRunInMode ()
#20 0x908fdf6c in RunCurrentEventLoopInMode ()
#21 0x908fdd23 in ReceiveNextEventCommon ()
#22 0x908fdba8 in BlockUntilNextEventMatchingListInMode ()
#23 0x96b4eac5 in _DPSNextEvent ()
#24 0x96b4e306 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#25 0x96b1049f in -[NSApplication run] ()
#26 0x96b08535 in NSApplicationMain ()
#27 0x00002c8c in main (argc=1, argv=0xbffff858) at /Users/catlan/Projekte/TBU/main.m:13
Any idea on how to debug this?
I have made this game for Mac OS, but I realised that i need to make it better with multiplayer.
Im an experienced Cocoa developer (so please, no RTFM's) but for some reason I never even touched on networking. I was wondering how I could send game date from com1 to com2, and vice versa, over different wifi networks.
Cheers, Conor
Edit: When I say different wifi networks, I mean no bonjour. I want to be able to play the game in the US with a guy in china!
I am seeing a huge memory leak when using UIImagePickerController in my iPhone app. I am using standard code from the apple documents to implement the control:
UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
switch (buttonIndex) {
case 0:
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imagePickerController animated:YES];
break;
case 1:
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagePickerController animated:YES];
break;
default:
break;
}
}
And for the cancel:
-(void) imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[[picker parentViewController] dismissModalViewControllerAnimated: YES];
[picker release];
}
The didFinishPickingMediaWithInfo callback is just as stanard, although I do not even have to pick anything to cause the leak.
Here is what I see in instruments when all I do is open the UIImagePickerController, pick photo library, and press cancel, repeatedly. As you can see the memory keeps growing, and eventually this causes my iPhone app to slow down tremendously.
As you can see I opened the image picker 24 times, and each time it malloc'd 128kb which was never released. Basically 3mb out of my total 6mb is never released.
This memory stays leaked no matter what I do. Even after navigating away from the current controller, is remains the same. I have also implemented the picker control as a singleton with the same results.
Here is what I see when I drill down into those two lines:
Any help here would be greatly appreciated! Again, I do not even have to choose an image. All I do is present the controller, and press cancel.
Update 1
I downloaded and ran apple's example of using the UIIMagePickerController and I see the same leak happening there when running instruments (both in simulator and on the phone).
http://developer.apple.com/library/ios/#samplecode/PhotoPicker/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40010196
All you have to do is hit the photo library button and hit cancel over and over, you'll see the memory keep growing.
Any ideas?
Update 2
I only see this problem when viewing the photo library. I can choose take photo, and open and close that one over and over, without a leak.
Hi folks
Sorry if this is an easy one. Basically, here is my code:
MainViewController.h:
//
// MainViewController.h
// Site
//
// Created by Jack Webb-Heller on 19/03/2010.
// Copyright __MyCompanyName__ 2010. All rights reserved.
//
#import "FlipsideViewController.h"
@interface MainViewController : UIViewController <UIWebViewDelegate, FlipsideViewControllerDelegate> {
IBOutlet UIWebView *webView;
IBOutlet UIActivityIndicatorView *spinner;
}
- (IBAction)showInfo;
@property(nonatomic,retain) UIWebView *webView;
@property(nonatomic,retain) UIActivityIndicatorView *spinner;
@end
MainViewController.m:
//
// MainViewController.m
// Site
//
// Created by Jack Webb-Heller on 19/03/2010.
// Copyright __MyCompanyName__ 2010. All rights reserved.
//
#import "MainViewController.h"
#import "MainView.h"
@implementation MainViewController
@synthesize webView;
@synthesize spinner;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
}
return self;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
NSURL *siteURL;
NSString *siteURLString;
siteURLString=[[NSString alloc] initWithString:@"http://www.site.com"];
siteURL=[[NSURL alloc] initWithString:siteURLString];
[webView loadRequest:[NSURLRequest requestWithURL:siteURL]];
[siteURL release];
[siteURLString release];
[super viewDidLoad];
}
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
[self dismissModalViewControllerAnimated:YES];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[spinner stopAnimating];
spinner.hidden=FALSE;
NSLog(@"viewDidFinishLoad went through nicely");
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
[spinner startAnimating];
spinner.hidden=FALSE;
NSLog(@"viewDidStartLoad seems to be working");
}
- (IBAction)showInfo {
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[spinner release];
[webView release];
[super dealloc];
}
@end
Unfortunately nothing is ever written to my log, and for some reason the Activity Indicator never seems to appear. What's going wrong here?
Thanks folks
Jack
I want to wait for latitude.text and longtitude.text to be filled in before sending a tweet, this code works fine, but I would rather not put the tweeting part in locationManager because I also want to sometimes update the current location without sending a tweet. How can I make sure the txt gets filled in before sending the tweet without doing this?
- (IBAction)update {
latitude.text =@"";
longitude.text =@"";
locmanager = [[CLLocationManager alloc] init];
[locmanager setDelegate:self];
[locmanager setDesiredAccuracy:kCLLocationAccuracyBest];
[locmanager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLLocationCoordinate2D location = [newLocation coordinate];
latitude.text = [NSString stringWithFormat: @"%f", location.latitude];
longitude.text = [NSString stringWithFormat: @"%f", location.longitude];
TwitterRequest * t = [[TwitterRequest alloc] init];
t.username = @"****";
t.password = @"****";
[twitterMessageText resignFirstResponder];
loadingActionSheet = [[UIActionSheet alloc] initWithTitle:@"Posting To Twitter..." delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
[loadingActionSheet showInView:self.view];
[t statuses_update:twitterMessageText.text andLat:latitude.text andLong:longitude.text delegate:self requestSelector:@selector(status_updateCallback:)];
twitterMessageText.text=@"";
}
I want to build a custom control to reuse in my project which consists of two UITextFields that are linked together + a label.
It is starting to become repetitive across my App and smells of code duplication ;)
However, I wonder what is the best aproach here.
Is it best do everything by code in a controller or is posible do a visual thing like the ones built-in in Xcode?
A form is pushed onto the view. The form has several required fields. Also the form needs to be validated. I want to intercept the back button's click to check if the fields have been filled in, and validate the form. How would I intercept the button's click, and make sure it doesn't pop to the previous screen?