In my iPhone App I'd like to draw a few formulas. How can I manage that with quartz 2d? Is there a way to build formulas like for example in latex? Or are there any existing frameworks? Thanks.
Hi,
I am writing a small game in cocos2d. I am adding child
[ self addChild: sprite1];
Should I remove these before going to next scene by using
[self removeChild: sprite1 cleanup:YES];
Does it increase the performance in device ?
Thank You.
What are all the file formats supported by UIWebView?
In my testing, I found that it supports XLS, DOC, PPT, PDF but not XLSX, and DOCX, RTF.
It supports image files like, JPG, PNG, GIF, BMP, not sure about TIFF or
Exactly, what all types are supported is not clear...
The UIWebView documentation also doesn't state it clearly.
Could someone please help?
Hi, I have a map image in a uiwebview. It default loads in the top left hand corner. I would like it to initialize in the center of the uiwebview.
Does anyone know how to do this?
Thanks!
I know Apple is not the only ressource out there, and many people create great videos in conferences and presentations.
If someone knows a great video or podcast on the topics KVC or KVO, please let me know. I would be glad about it!
Edit: Changed Title so it's more clear this is indeed programming related. KVO / KVC / MVC != KFC
I'm wanting to create a view (UIControl) which blocks all input and shows a UIActivityIndicatorView while authenticating a user.
The UIActionSheet and UIAlertView both manage to add a black semi-transparent view over the top of all other views to block input and I'd like to do similar.
I've tried adding my view to the top UIWindow in the [[UIApplication sharedApplication] windows] array, and while this does place it above the UIKeyboard if it's visible, it doesn't place it over the StatusBar (which makes sense).
My next attempt was to extend UIAlertView, remove all of its subviews and set its layer.contents = nil, then add the ActivityIndicator as a subview. This works well, but I can't seem to kill the default bouncy transition of the UIAlertView when you call it to "show".
Does anyone have any pointers towards the best way tackle this problem that gives me full control?
Oh and I know blocking input is not great but I do ensure it's for a short period of time and it has the benefit of making it clear to the user that their action, which must complete for them to progress, is processing.
After going into Edit mode, moving a cell, and leaving edit mode, i am left with one extra cell sitting on top of its duplicate cell while still in edit mode.
The problem has to be somewhere in here:
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
NSMutableArray *array = [[fetchedResultsController fetchedObjects] mutableCopy];
id objectToMove = [[array objectAtIndex:sourceIndexPath.row] retain];
[array removeObjectAtIndex:sourceIndexPath.row];
[array insertObject:objectToMove atIndex:destinationIndexPath.row];
[objectToMove release];
for (int i=0; i<[array count]; i++) {
[(NSManagedObject *)[array objectAtIndex:i] setValue:[NSNumber numberWithInt:i] forKey:@"userOrder"];
}
[array release];
}
Any guidance greatly appreciated!
hellow all, in xcode whenever we load a mapview ,it automaticallay shows the current user location right. In my case i am showing another location on map ,such that the map loads the current location and zoomed to the location i have given .. but, the current location point was not showing (the blue one which comes automaticay..).
i have given mapView.showCurrentLocation=TRUE; but its not showing .
so could any one tells the way it works and it should say the current location mark and then zoomed to the point i have given.
Thanks
Hey guys,
How can I figure out which word is at the point where the user tapped on a UIWebView?
I am able to detect the CGPoint for the tap (subclassing UIWindow like this), and I can actually get the DOM element on that point using javascript.
But I know very little of javascript and DOM to figure out how can I actually get which word the user tapped on.
Is that possible? Here's what I have right now:
int scrollPosition = [[webView stringByEvaluatingJavaScriptFromString:@"window.pageYOffset"] intValue];
NSString *js = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).tagName", point.x, point.y+scrollPosition];
NSString *value = [webView stringByEvaluatingJavaScriptFromString:js];
NSLog(@"element: %@", value);
Hello,
I'm trying to figure out how to group items like the grouped mail boxes in the mail app. I need it to be like selecting a mail box, when you tap it it loads new data, your inbox outbox and all of the other boxes for that mail account. Then you can tap back and return to all of your accounts. If anyone has a little sample code they could show or explain how one might go about doing this any help is appreciated. (Note: Im using the split view template)
Thanks
I have a ViewController with a view (UIView). I need to handle touches, run some logic, check against model data, and and add and remove sublayers to the view based on those touches. Then I need to update the model based on the results.
Should I have:
ViewController - manage touches, get/set model data, add/remove sublayers
UIView
CALayer
Sublayers
or
Controller (NSObject) - get/set data
ViewController - manage touches, add/remove sublayers
UIView
CALayer
Sublayers
or
Controller (NSObject) - get/set data
CustomView - manage touches, add/remove sublayers
CALayer
Sublayers
Or is it something else all together? No matter what I try, it "feels" awkward. SVN is my friend.
Can you guys help a girl (with architectural issues) out?
So, I thought consulting you guys about my design, cause I sense there might be a better way of doing it.
I need to implement game bonuses mechanism in my app.
Currently there are 9 bonuses available, each one is based of different param of the MainGame Object.
What I had in mind was at app startup to initialize 9 objects of GameBonus while each one will have different SEL (shouldBonus) which will be responsible for checking if the bonus is valid.
So, every end of game I will just run over the bonuses array and call the isBonusValid() function with the MainGame object(which is different after every game).
How's that sound ?
The only issue I have currently, is that I need to make sure that if some bonuses are accepted some other won't (inner stuff)... any advice how to do that and still maintain generic implementation ?
@interface GameBonus : NSObject {
int bonusId;
NSString* name;
NSString* description;
UIImage* img;
SEL shouldBonus;
}
@implementation GameBonus
-(BOOL) isBonusValid(MainGame*)mainGame
{
[self shouldBonus:mainGame];
}
@end
Hi all,
In my application, the view below navigation controller moves up and is visible below the navigation bar as it's becoming transperant after adding a barbuttonitem programmatically to the navigation controller which I'm adding to view through an xib.
Thanx in advance.
I have a UITabBarController that is loading a UINavigationController.
When I push a new view controller, is it possible to change the UITabBarController to a new set of tabs?
i am declaring cg-point or rect as const it giving above error any one help this,,
#import "newViewController.h"
#import "first.h"
const CGPoint point=CGPointMake(50,50);
- (void)viewWillAppear:(BOOL)animated {
app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
-(void)webViewDidFinishLoad {
app.networkActivityIndicatorVisible = NO;
}
I want to hide the network activity indicator after webpage is loaded. I had written the above code. But the indicator is not hiding after the webpage is fully loaded.
Anyone please help.
I have a Paging UIScrollView with a contentSize large enough to hold a number of small UIScrollViews for zooming, The viewForZoomingInScrollView is a viewController that holds a CALayer for drawing a PDF page onto. This allows me to navigate through a PDF much like the ibooks PDF reader.
The code that draws the PDF (Tiled Layers) is located in:
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx;
And simply adding a 'page' to the visible screen calls this method automatically. When I change page there is some delay before all the tiles are drawn, even though the object (page) has already been created.
What i want to be able to do is render the next page before the user scrolls to it, thus preventing the visible tiling effect. However, i have found that if the layer is located offscreen adding it to the scrollview doesn't call the drawLayer.
Any Ideas/common gotchas here?
I have tried:
[viewController.view.layer setNeedsLayout];
[viewController.view.layer setNeedsDisplay];
NB: The fact that this is replicating the ibooks functionally is irrelevant within the context of the full app.
Hey guys,
UIBarButtonItem does not extend UIView, so there is nothing like a frame property.
But is there any way I can get what is it's CGRect frame, relative to the application UIWindow?
If you want to modify the default behaviour of a View Controller by changing the value of one of its properties, is it considered better form to
instantiate the class and set its property directly, or
subclass it and override the property?
With the former it would become the parent View Controller's responsibility to configure its children, whereas with the latter the children would effectively configure themselves.
EDIT: Some more information:
The class I am referring to is FetchedTableViewController, a subclass of UITableViewController that I made to display the results of a Core Data fetch operation.
There are two places I want to display the results of a fetch, and they each have different fetch requests.
I'm trying to decide whether it's better to create a subclass for each one, and override the fetchRequest property, or make it the responsibility of the parent controller to set the fetchRequest property for its children.
I have a uinavigationcontroller with 2 views. In the second view I have some audio playing. When I click the back navigation item on the navigation bar the audio still plays. How do I end the process of anything happening in the second view when the user clicks back to the initial view.
Thanks for your help.
Hi all,
On my iphone app, I have a UITableView in edit mode, containing custom UITableViewCell.
I would like to detect when user has clicked on the left button of each cell (minus circular red button, the one that is animated with a rotation), just before the "Delete" button appears.
I would like to be able to change my cell content in that case...
Is that possible ?
Thanks !
Say that there are no WIFI networks currently available and my network-enabled app is connected over 3G. How can I detect if a user has roamed into a WIFI network? I would also like to detect the case when the user is connected over WIFI and suddenly received 3G signal.
In other words, I would like to be asynchronously notified of network adapter changes. I tried using the SCNetworkReachability framework asynchronously but found that for some reason, I am not receiving Wifi-related events (i.e. adapter on/off) when connected over 3G.
Hi have setup a sample application using a UITableView. Initially I did this by conforming my controller to and , added a tableView in IB and connected "datasource" & "delegate" to Files Owner. It all works so thats good.
What I have been trying out is creating my own class for the delegate. I created a new class and added and , but quickly found I could not connect the tableViewdataSource / delegate. To solve this I added an "Object" (NSObject) in IB and set it to my new class. I then connected the dataSource and delegate outlets to this object. It sort of works, the app runs and displays the tableView, but when I try and scroll the table the app crashes. Can I ask if I am going about this the right way?
gary
I'm trying to animate a GIF and I hit a roadblock. I have an example of what I'm trying to do that uses the individual frames of the GIF and setting the animationImages property of a UIView. However in my project, the thing I want to animate is drawn using Layers. I'm looking for a quick and easy way to animate the frames without introducing too much complexity. Is there any animationImages equivalent with Layers? Does anybody have any ideas?
I have 3 UITextFields in a grouped UITableView and am trying to figure out the correct logic to only have my 'Save' UIBarButtonItem enabled when none of the UITextFields are empty.
I'm currently using the - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string UITextField delegate method to detect changes to the field character by character, but it is providing inconsistent results.
Any ideas?