I am doing iPhone development and how to make CGRect return double value? I found there was a macro "#define CGFLOAT_IS_DOUBLE", but how can I change it?
I have a custom UIViewController in a UITabbarController and want to respond to rotation events. When a rotation occurs, the tabbarcontroller and the viewcontroller get rotated. However, the view in the viewcontroller doesn't get redrawn properly: the layout doesn't autoresize and it is black on parts of the screen.
The strange thing is that it works when I go to another tab and the back again to my original viewcontroller.
What could possibly be wrong? I checked that didRotateFromInterfaceOrientation:fromInterfaceOrientation is being called. However, the view.frame.size values are still the old ones from before the rotation. That's probably not correct.
I've added a navigation bar to a UIViewController. It is displayed from another UIViewController only. I'd like to have a left side back button that is shaped similar to an arrow, just like the normal navigation bar back button. It seems I can only add a bar button through IB. I'm guessing the back button needs to be added programmatically. Any suggestions on how I should do this?
Hey
is there any way to send whats in a text view (im trying to make a suggestion box) to my email address?
example
user types in the box " I think you should add twitter support"
then that is sent in the background to my email address [email protected]
then a message is popped up on the screen saying "suggestion sent"
just an example of what i mean
Any ideas, tutorial links would be greatly appreciated guys
Thanks
Hi,
I ma writing an application where I have to parse multiple xml files as a response from a server. Till now, I have written different xml parser classes for each xml depepending on the tags present in different xmls ? Can I combine all xml parser classes and write a single xml parser that handles all different tags in different xmls ? Will it work ? Will combining xml parser classes add an overhead because xml parser will check for every tag irrespective of whether that is part of file or not ?
Please help.
I'm doing a Gdata Blogger from Android device:
GoogleLoginServiceHelper.getCredentials(this, REQUEST_CODE_LOGIN, null,
GoogleLoginServiceConstants.REQUIRE_GOOGLE,
BLOGGER_SERVICE, true);
I have this permissions in my manifest:
But I got a SecurityException:
ERROR/AndroidRuntime(20985): java.lang.SecurityException: caller pid 20985 uid 10044 lacks com.google.android.googleapps.permission.GOOGLE_AUTH.BLOGGER
What could be wrong?
Hey Guys,
does anybody know how i can access a custom cell within the - (void)tableView:commitEditingStyle:forRowAtIndexPath:. I need access to my Custom Cell Class to retrieve some parameters.
Thanks.
Hi guys,
I have an object NetworkMember that has no attributes but is defined by its relationships Person, Network, Level and Role. In my app, I've found all the four relationships, but I want to make sure not to double-register my NetworkMember, thus I'd like to search for this NSManagedObject before instantiating it.
How should I write a query that queries for an NSManagedObject just consisting of relationships?
Cheers
Nik
I am having MKAnnotationView and i have added UIButton to it, by addSubView method with IBAction assigned to it using addTarget method. But when i tabbed on that button IBAction doesn't called ....!
I am not getting, Why it is not working?
How can i add button to MKannotationView so that its IBAction called ???
Plz. help me.
Thanks
Hey there,
I am planning to develop an iPhone application heavily relying on sqlite DB ,
from different links I have gone through this seems to be a great tool and has some really good support.
As my app is still in the planning process
I would like to ask if there are any Issues with SQLlite database ? from memory management to Queries and data sizes and multiple access etc;
Please share your experience using SQLite DB in iPhone and what problems did you face?
I just want to make a note of these exceptions so that I may plan my App well and do not have any issues raised in the middle of the development process.
Thanx for your contribution.
I want to use AVAudioPlayer to play M4p files from iTunes generator. I could use uiWebView to play it and it worked, but I want to put an image of my choice on the background of the player instead of the "quick time" logo. Can you help me as how to do this?
Here is an example of the m4p file I want to play with AVAudioPlayer.
http://a801.phobos.apple.com/us/r1000/059/Music/b9/0d/be/mzi.zqnndbil.aac.p.m4p
Seriously, big thanks in advance!!
I tried using the load function of the SoundPool that takes a FileDescriptor, because I wanted to be able to set the offset and length. The File is not stored in the Ressources but a file on the storage card. Even though neither the load nor the play function of the SoundPool throw any Exception or print anything to the console, the sound is not played. Using the same code, but use the file path string in the SoundPool constructor works perfectly.
This is how I have tried the loading (start equals 0 and length is the length of the file in miliseconds):
FileInputStream fileIS = new FileInputStream(new File(mFile));
mStreamID = mSoundPool.load(fileIS.getFD(), start, length, 0);
mPlayingStreamID = mSoundPool.play(mStreamID, 1f, 1f, 1, 0, 1f);
If I would use this, it works:
mStreamID = mSoundPool.load(mFile, 0);
mPlayingStreamID = mSoundPool.play(mStreamID, 1f, 1f, 1, 0, 1f);
Any ideas anyone?
Thanks
Hello guys,
I've been trying to blend two UIImage for about 2 days now and I've been getting some BAD_ACCESS errors. First of all, I have two images that have the same orientation, basically I'm using the CoreGraphics to do the blending.
One curious detail, everytime I modify the code, the first time I compile and run it on device, I get to do everything I want without any sort of trouble. Once I restart the application, I get error and the program shuts down.
Can anyone give me a light? I tried accessing the baseImage sizes dynamically, but it gives me bad access too.
Here's a snippet of how I'm doing the blending.
UIGraphicsBeginImageContext(CGSizeMake(320, 480));
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0, 480);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, rect, [baseImage CGImage]);
CGContextSetBlendMode(context, kCGBlendModeOverlay);
CGContextDrawImage(context, rect, [tmpImage CGImage]);
[transformationView setImage:UIGraphicsGetImageFromCurrentImageContext()];
UIGraphicsEndImageContext();
Although my relativelayout looks very similar on WVGA800 and WVGA854 on the emulator, theres different spacing on some of the objects because I'm going off of marginleft or marginright. Since the 854 is a greater width, its pushing some objects differently. Is there any way I could target either one to adjust for the different margins?
In my project directory, top level, I have Icon.png. Double-checked in Photoshop, it's 57x57. When I submit my application via iTunes Connect or Application Loader, I get an error message saying my icon file is 0x0. Any idea why this happens?
I'm working on a little game in OpenGL ES.
In the background, there is a world/map. The map is just a large texture.
Zoom/pinch/pan is used to move around. And I'm using glOrthof (left, right, bottom, top, zNear, zFar) to implement the zoom/pinch.
When I zoom in, the sprites on top of the map is also zoomed in. But I would like to have some sprites stay at a fixed size.
I could probably calculate a scale factor, depending on the parameters to glOrthof, but there must be a more natural and straightforward way of doing that, instead of scaling the sprites down when I zoom in.
If I add some text or some GUI elements on top of the map, they should definately have a fixed size.
Is there a solution to do this, or do I have to leave fixed values in glOrthof and implement zoom/pinch in another way?
EDIT: To be more clear: I want sprites that zoom in/out along with the map, but stay at the same size.
I have some elements that are like the pins on the iPhone's map application. When you zoom, the pins stay the same size, but move around on the screen to stay on the same spot on the map. That is mainly what I want a solution for.
Solutions for this already came below, thanks!
Hi all,
I want to use mobile substrate to "hook" some code into IPhone's "MobileCal" app so that the injected code will send a notification to my app MobileCal gets a call notification. But I'm out of luck and no clue which method need to be replaced by my "hooking" method in the "MobileCal" app.
For example, the "MobileLog" and "iRealSMS" has the same functionality and they used mobile substrate to hook their code into "MobileCal" app.
If any one has any clue, I would definitely appreciate them.
Hi,
I have a linear layout in my main.xml which has a listview. Now I want to create a bottom bar below listview.
Bottombar has a background image and two buttons with their individual background images. I want to put these two buttons on common background image.
I have read that this can be achieved using FrameLayout. But since I am using LinearLayout as base layout in my main.xml, is there any way to this design using linearlayout ?
When I select a cell in section 0 of my tableview I always get taken to section 1 first ?
I think its somthing to do with my 'if' statments
code : http://pastie.org/868523
Thanks in advance.
I'm writing code that will allow my iphone-app to have a "configuration page".
A grouped, scrolling, UITableView... with cells that contain the needed textFields, switches, sliders, etc.
It is an ENOURMOUS amount of code. Is there an easier way?
Is there a way I could create a simple text-file, contain all my desired design choices and have my (reusable) code build the TableView for me?
Or... can I just do the whole thing quicker/easier in Interface Builder instead of code?
I'm logging gps points during a walk. Below it shows the function that the coordinates are saved each 5 seconds.
i Did several tests but i cannot get the right accuracy i want. (When testing the sky is clear also tests in google maps shows me that the gps signal is good).
here is the code:
-(void)viewDidAppear:(BOOL)animated{
if (self.locationManager == nil){
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
locationManager.delegate = self;
// only notify under 100 m accuracy
locationManager.distanceFilter = 100.0f;
locationManager.desiredAccuracy= kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
}
}
- start logging
[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(getData) userInfo:nil repeats:YES];
</code>
<code>
-(void)getData{
int distance;
// re-use location.
if ([ [NSString stringWithFormat:@"%1.2f",previousLat] isEqualToString:@"0.00"]){
// if previous location is not available, do nothing
distance = 0;
}else{
CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:previousLat longitude:previousLong];
CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:latGlobal longitude:longGlobal];
distance = [loc1 getDistanceFrom: loc2];
}
// overwrite latGlobal with new variable
previousLat = latGlobal;
previousLong = longGlobal;
// store location and save data to database
// this part goes ok
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
// track the time to get a new gps result (for gps indicator orb)
lastPointTimestamp = [newLocation.timestamp copy];
// test that the horizontal accuracy does not indicate an invalid measurement
if (newLocation.horizontalAccuracy < 0) return;
// test the age of the location measurement to determine if the measurement is cached
// don't rely on cached measurements
NSTimeInterval locationAge = -[newLocation.timestamp timeIntervalSinceNow];
if (locationAge > 5.0) return;
latGlobal = fabs(newLocation.coordinate.latitude);
longGlobal= fabs(newLocation.coordinate.longitude);
}
I have taken a screenshot of the plot results (the walk takes 30 minutes) and an example of what i'am trying to acomplish:
http://www.flickr.com/photos/21258341@N07/4623969014/
i really hope someone can put me in the right direction.
How would you write a universal app that uses classes introduced in iPhone OS 3.2, such as UIPopoverController and UISplitViewController? On Jeff LaMarche's blog about this, Ole provides a method for instantiating these objects; you would instantiate a UIPopoverController like so: [NSClassFromString(@"UIPopoverController") alloc].
This is fine for instantiating these classes in code but what about protocols and their methods? My iPad app uses a UISplitViewController and has a class that needs to conform to the UISplitViewControllerDelegate and UIPopoverControllerDelegate. How would you declare this? And how would you work with a method such as the following?
- (void)splitViewController:(UISplitViewController *)svc
willHideViewController:(UIViewController *)aViewController
withBarButtonItem:(UIBarButtonItem *)barButtonItem
forPopoverController:(UIPopoverController *)pc
where the method call requires UISplitViewController to be passed in?