In my viewForAnnotation delegate, I create a MKAnnotationView with leftCalloutaccessory as a info button. When the info button is tapped, I want to replace it with a UIActivityIndicator. So in the calloutAccessoryTapped delegate, I wrote
view.leftCalloutaccessoryView = [UIActivityIndicator indicatorWithStyle:UIActivityIndicatorWhite];
The callout accessory seems to change, but it seems like the view doesn't get updated immediately.
That's when the callout accessory gets hidden (by tapping another pin) and is re-opened, I see a spinner. But otherwise, I don't.
I tried calling [view setNeedsdisplay] and [view setNeedsLayout] and [view layoutsubviews] as well but in vain.
Any suggestions/pointers?
Hi, I am trying to create an item list, diffrent for each i and j variable. My code is:
if (i == 0) {
if (j == 0) {
final CharSequence[] items = {"4:45", "5:00"}
} else if (j == 1) {
final CharSequence[] items = {"4:43", "4:58"}
} else if (j == 2) {
final CharSequence[] items = {"4:41", "4:56"}
} else {
final CharSequence[] items = {"4:38", "4:53"}
}
...
new AlertDialog.Builder(this)
.setTitle("Hours")
.setItems(items,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialoginterface, int i) {
// getStation(i);
}
})
.show();
}
I get an error in the line .setItems(items,:
items cannot be resolved
I think that the compiler thinks that the CharSequence[] items may not be initialised or something...
How can I make this programme run?
Hi,
I'm doing something with UIImagePickerController.
It works fine and the Picture browser does open, however, I get this message. "Failed to save the videos metadata to the filesystem. Maybe the information did not conform to a plist."
What could be causing that? That is caused by this line [self presentModalViewController:self.imgPicker animated:YES]; which is activated on a button click
Snippets of the code that I have below.
- (void)viewDidLoad {
self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.allowsImageEditing = YES;
self.imgPicker.delegate = self;
}
- (IBAction)grabImage {
[self presentModalViewController:self.imgPicker animated:YES];
}
it's also removing images from documents directory and from resources folder. I can not understand why? does someone found the solution to this?
This is my method:
-(void) playOrRecord:(UIButton *)sender {
if (playBool == YES) {
NSError *error = nil;
NSString *filePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat: @"%d", [sender tag]] ofType:@"caf"];
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error];
[player setNumberOfLoops:0];
[player play];
}
else if (playBool == NO) {
if ([recorder isRecording]) {
[recorder stop];
[nowRecording setImage:[UIImage imageNamed:@"NormalNormal.png"] forState:UIControlStateNormal];
[nowRecording setImage:[UIImage imageNamed:@"NormalSelected.png"] forState:UIControlStateSelected];
}
if (nowRecording == sender) {
nowRecording = nil;
return;
}
nowRecording = sender;
NSError *error = nil;
NSString *filePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat: @"%d", [sender tag]] ofType:@"caf"];
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
[sender setImage:[UIImage imageNamed:@"RecordingNormal.png"] forState:UIControlStateNormal];
[sender setImage:[UIImage imageNamed:@"RecordingSelected.png"] forState:UIControlStateSelected];
recorder = [[AVAudioRecorder alloc] initWithURL:fileUrl settings:recordSettings error:&error];
[recorder record];
}
}
Most of it is self explanatory; playBool is a BOOL that is YES when it is in play mode.
Everything works in the simulator however, when I run it on a device, [recorder record] returns NO. Does anyone have a clue as to why this is happening?
When i try to check leaks of my iPhone App using Instruments, everything is just fine.
Same App on actual real device shows this leak for a few times during the app launch. It is pretty non-deterministic and it happens in system libraries.
I tried to google down the solution without a luck.
Anyone experiencing the same problems? Anyone knows the solution?
I find interesting, that every of my leak in code will crash the app sooner or later. These GeneralBlock-3584 leaks keeps app perfectly stable.
Might this be reason for AppStore rejection?
Thanx for any answer regarding this undocumented problem (Apple is silent unfortunately).
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 have a WebView which loads a PDF file:
[myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL
fileURLWithPath:[[NSBundle mainBundle] pathForResource:fileName
ofType:@"pdf"]isDirectory:NO]]];
It works fine on iPhone OS 2.x but on iPhone 3.0, when I tap the PDF for scrolling, this error appears, and the app crash:
-[NSCFDictionary _absoluteLinkURL]: unrecognized selector sent to instance
0x1c0230 Terminating app due to
uncaught exception
'NSInvalidArgumentException', reason:
'-[NSCFDictionary
_absoluteLinkURL]: unrecognized selector sent to instance 0x1c0230'
When I add libiphone-exif.a to snapandrun in objectiveflickr I get this error:
".objc_class_name_EXFJpeg", referenced from:
literal-pointer@__OBJC@__cls_refs@EXFJpeg in SnapAndRunViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I do not know what this means, I follow the guide to add it, add all of the .h files and the libiphone-exif.a
Is there something special I have to do?
Hey Everyone,
I am trying to implement a TextView that is serving as a header for a ListView. I want to format it so that I have basically a title centered on the first line and then additional information on the lines following. How can I format the text/string to create this kind of formatting?
Thanks,
Rob
Hi
I made a plist that looks like that:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList 1.0.dtd">
<plist version="1.0">
<array>
<array>
<dict>
<key>Company</key>
<string>xxx</string>
<key>Title</key>
<string>VP Marketing</string>
<key>Name</key>
<string>Alon ddfr</string>
</dict>
<dict>
<key>Name</key>
<string>Adam Ben Shushan</string>
<key>Title</key>
<string>CEO</string>
<key>Company</key>
<string>Shushan ltd.</string>
</dict>
</array>
<array>
<dict>
<key>Company</key>
<string>xxx</string>
<key>Title</key>
<string>CTO</string>
<key>Name</key>
<string>Boaz frf</string>
</dict>
</array>
</array>
</plist>
Now I want to extract the data like that (all the 'A' for key "Name" to one section and all the 'B' "Name" to other one):
NSString *plistpath = [[NSBundle mainBundle] pathForResource:@"PeopleData" ofType:@"plist"];
NSMutableArray *attendees = [[NSMutableArray alloc] initWithContentsOfFile:plistpath];
listOfPeople = [[NSMutableArray alloc] init];//Add items
NSDictionary *indexADict = [NSDictionary dictionaryWithObject:[[attendees objectAtIndex:0] objectForKey:@"Name"] forKey:@"Profiles"];
NSDictionary *indexBDict = [NSDictionary dictionaryWithObject:[[attendees objectAtIndex:1] objectForKey:@"Name"] forKey:@"Profiles"];
[listOfPeople addObject:indexADict];
[listOfPeople addObject:indexBDict];
This in order to view them in sectioned tableView.
I know that the problem is here:
NSDictionary *indexADict = [NSDictionary dictionaryWithObject:[[attendees objectAtIndex:0] objectForKey:@"Name"] forKey:@"Profiles"];
But I just can't figure how to do it right.
Thanks.
Hi all,
I am creating application in cocos2d, but one thing I would like to know is it possible to use xib file in cocs2d as we are using in simple iPhone application creation?
If yes then how to make call to such xib files, can any one tell me the answer, is is possible or not?
Thanks in advance.
Hi All,
Having a problem with NSURLConnection, if I create a NSURLConnection and call [connection connectionWithRequest] let it load a little then call [connection cancel] most of the time that works fine. However occasionally even after I call [connection cancel] the connection's delegate still gets called (which crashes the app). Googling around it looks like the problem here is a race condition in the runloop, I cancel the connection and release the delegate but before the runloop cycles it calls the delegate functions - crash.
Is there a way for me to, after I call [connection cancel] confirm the connection has actually canceled? Even a crappy while() loop will do :(
This error
Thu Apr 8 20:24:15 iPod-touch appname[947] <Error>: Error: Embedded profile header length is greater than data length.\n
Thu Apr 8 20:24:16 iPod-touch appname[947] <Error>: Error: Embedded profile header length is greater than data length.\n
is logged when a UIImageView is loaded. The view isn't huge but it has a few other UIImageViews as subviews and it might be related to memory, but I can't find anything on this message. Any ideas?
Hey all. I have a fairly simple question. I am developing a "rich" iPad app, and I have two background images specifically designed for landscape and portrait. I'd like this ImageView to automatically change depending on the devices orientation. (like pretty much all of Apples iPad apps).
Can anyone point me in the right direction? I'm assuming it would be something I do on viewDidLoad..
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.
Is it possible to stop all started services when the user hits the Home Button?
I use:
startService(new Intent(ClassName.this, ClassName2.class));
stopService(new Intent(ClassName.this, ClassName2.class));
This means I will have to somehow add the 'stopService()' for 7+ of my app classes
I've researched this topic and I think there's 'onTerminate' but still not sure how this should be implemented.
Any help or hints would be appreciated!
Thanks!
Hi All,
Hope to get solution to this problem. I have been stuck on it since a long time now.
I have a a tableView which has custom labels drawn upon the cell using CGRect. I receive the data from a web service in arrays. Initially i display a line of data on the cells. When the user selects a cell, I call reloadsRowAtIndexPath to increase the height of selected row. In the process, cellForRowAtIndexPath gets called again. I keep track of this by a flag, and when cellForRowAtIndexPath gets called again, I display the two more lines of data from arrays, on the cell.
What i am getting is all overlapping data on one other. I tried to remove already placed labels in didSelectRowAtIndexPath, but to no avail.
Please help me on this
Thanks in advance.
Hi!
I was wondering if I can deallocate the depth buffer in iPhone OpenGL ES to conserve memory? Or it stays until the application finishes?
I only need the depth testing in the beginning of the application.
Hello, I'm trying to pass the user on to the interface based on their cell selection in the UITableView, ie, if the user selects cell 1, they are taken to view model 2, containing UIWebView. UIWebView then displays local file, cell1.html.
Currently, I've manage to get placeholder using:
selectedCellText.text = selectedCell;
to display the name of the cell selected. How do I get it to directly pass to the UIWebView, stick UIWebView in the interface and link it using:
UIWebView *myWebView = [[UIWebView alloc] initWithFrame:frame];
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *stringUrl = [mainBundle pathForResource:@"selectedCell" ofType:@"html"];
NSURL *baseUrl = [NSURL fileURLWithPath:stringUrl];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:baseUrl];
[myWebView loadRequest:urlRequest];
My other issue is that some of the cell names have spaces in them, and for simplicity, I'd like to ensure that there are no spaces (actually, will it even work with spaces in the name, I assume with %20 ?
Thanks
In the method below titleForHeaderInSection, for some reason the NSLog prints out the headers twice and then the app crashes in objc_msgSend. I can't understand why this would cause the app to crash?
It would seem from research that crashes in objc_msgSend are caused by sending messages to already freed objects, but is that the case here?
My sectionNames array is populated in viewDidLoad.
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
NSString *title = nil;
title=[sectionNames objectAtIndex:section];
NSLog(title);
return title;
}
Thanks
Hi ,
Is there any iphone library for accessing the full photo gallery,which should help me to access and upload all the images.
Not looking like three20 application ,expecting some information from iphone api's
Thanks in advance.............