I wanted to allow for a method to get called, if a finger was dragged from outside into the bounds of a control. I thought UIControlEventTouchDragEnter would do it, but it doesn't seem to. Does anyone know if there is a way to trigger an action based on a tap sliding into a control?
This is what I was trying, but got no calls to my -fingerSlidIn:
[aButton addTarget:self action:@selector(fingerSlidIn:withEvent: ) forControlEvents: UIControlEventTouchDragEnter];
Thanks!
I have several text fields in a custom uiviewcontroller subclass, which is displayed within a popover. The popover is displayed form a bar button. I want the keyboard to go down when the popover is dismissed (either by the user tapping the bar button again, or tapping outside the popover. From the view controller that displays the popover, when the popover is dismissed, in either of the 2 fashions, I call
[optionsController dismissFirstResponder];
Optionscontroller is the uiviewcontroller subclass in the popover. Dismissfirstresponder is a method I defined:
-(void)dsimissFirstResponder {
[nameField resignFirstResponder];
[descriptionField resignFirstResponder];
[helpField resignFirstResponder];
}
Those are three IBoutlets which I connected in the xib to the text fields.
That doesn't work. Any help with this would be greatly appreciated.
During inAppPurchase, the storeKit will ask the username and password
even though i set...
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
It ask Username and password in Portrait Mode... In general How to solve this kind of issue.
Thanks in advance,
I'm having some problem trying to present a modal view controller after it has been presented the first time, so I just start a little test method, it presents, dismisses and presents again the same controller modally.
// This is just test Code.
MYViewController *vc = [[MYViewController alloc] init];
[self presentModalViewController:vc animated:YES];
[self dismissModalViewControllerAnimated:YES];
[self presentModalViewController:vc animated:YES];
I get the error:
2011-11-15 09:50:42.678 Proyecto3[1260:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <RootViewController: 0x6d9d090>.'
The documentation does not add any clue here.
I'm trying link 40 buttons to one event handler method and then do the
processing work from one method instead of 40. I know how to link it
but once I get there I don't know how to distinguish what button was
pressed. Does anyone know how to reference the button object sender id
or is there another way to solve this problem?
Any help would be greatly appreciated.
I have a UITabBarControllerDelegate method that determines the title of the UITabBarItem and does something accordingly. This works well for items in my UITabBar but when I click on the More button the rest of my UITabBarItems are in a UITableView. How can I determine the title in the More section?
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if ([self.tabBarController.selectedViewController.title isEqualToString:@"All"]) {
//do something
}
}
When a UITextField with custom frame (200 × 54 px) loses focus, the text looks a little bit blurry.
example screenshot
Is this a common problem? Any workaround / solution or am I doing something wrong?
I can access the value like this:
NSNumber* rotationZ = [myLayer valueForKeyPath:@"transform.rotation.z"];
But for some reason, if I try to KV-observe that key path, I get a compiler error. First, this is how I try to do it:
[myLayer addObserver:self forKeyPath:@"transform.rotation.z" options:0 context:nil];
The compiler tells me:
*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[
addObserver: forKeyPath:@"rotation.z"
options:0x0 context:0x528890] was sent
to an object that is not KVC-compliant
for the "rotation" property.'
what I don't get is, why I can access that z value by KVC key path, but not add an observer to it. Does this make sense?
How else could I observe the z value of that matrix? I don't care about the other values of the matrix. Only the z rotation. Any other way to access and observe it?
Quick question if I may: I am just curious about the following (see below) Xcode says "initializer element is not constant" why this does not work, I guess its the NSArray ...
static NSArray *stuffyNames = [NSArray arrayWithObjects:@"Ted",@"Dog",@"Snosa",nil];
and this does ...
static NSString *stuffyNames[3] = {@"Ted",@"Dog",@"Snosa"};
gary
I have a card (a flashcard you could say)
What I can do:
On fingersweeping over the flashcard the card gets turned. It's happening by detecting
touchesBegan and touchesMoved and then I do stuff like
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
if (left) {
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.flashCardView cache:YES];
}else{
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.flashCardView cache:YES];
}
What I can't do (but want to):
I want to somehow drag the flip.
Imagine this, you have a flashcard and you think you know the answer, you start flipping the card around because you want to see if you are correct, but then... no stop... you hesitate, turn back the card to the way it was, rethink, get the real answer and then finally flip to see that you were right to hesitate.
Now I only have: once you start flipping, you can't stop it.
I have an app in which I render local HTML files in a UIWebView. The files, however, are sometimes large, and getting to where you want takes a long time with the default scroll speed. Is there any way to boost up the vertical scroll speed of a UIWebView?
In my past applications I have been #importing into my *.h files where needed. I have not really thought much about this before as I have not had any problems, but today I spotted something that got me to thinking that maybe I should be #import-ing into my .m files and using @class where needed in the headers (.h) Can anyone shine any light on the way its supposed to be done or best practice?
gary
I am curious if there is a good reason I should / should not be using @synthesize for the tabBarController below, or does it not matter?
@implementation ScramAppDelegate
@synthesize window;
@synthesize tabBarController;
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self setTabBarController:[[UITabBarController alloc] init]];
[window addSubview:[tabBarController view]];
[window makeKeyAndVisible];
return YES;
}
-(void)dealloc {
[tabBarController release];
[self setTabBarController: nil];
[window release];
[super dealloc];
}
OR
@implementation ScramAppDelegate
@synthesize window;
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
tabBarController = [[UITabBarController alloc] init];
[window addSubview:[tabBarController view]];
[window makeKeyAndVisible];
return YES;
}
-(void)dealloc {
[tabBarController release];
[window release];
[super dealloc];
}
cheers Gary
Hello,
I want to add a resize function to my app which works like the integrated copy feature on the iPhone. When the user opens the view he should see the image with the four blue dots which enable him to resize it. Is there an available example for this? Or has anyone the keywords for this functionality, which i can use for my further Search?
Thanks for all tips and hints
Hi all,
What is the best way to store an MKCoordinateRegion using core data? I assume there is a way to convert this to binary data somehow??
Many thanks
Jules
I have a UITableViewController that contains a tableView. I want to set its scrollView delegate to self, but I am not sure how to do that? if i call
[self.tableView.delegate = self]
It will set the UITableViewDelegate to self, and not the UIScrollViewDelegate
I am using push scene to get the next scene. But, I read that for each PushScene the scene is stored in stack. The memory usage is more. So, I am using the replaceScene in place of pushScene. But, with replace scene I am getting the memory-bad-access message in debugger.
So, I want to popScene after using it, so that the retain count is zero. But, I am confused in using popScene.
If I have a Scene1 and Scene2. I used the following to go in to Scene2. Now I need to remove Scene1 from stack.
[[CCDirector sharedDirector] pushScene:Scene2];
Where should I write the popScene to popScene1. How to get the previous scene in current running scene ?
Thank you/
I'd like to make my app to open a specified PDF by an external app of the user's choice on the iPad. How can I do that? Or, is there any open-source PDF reader framework available so that I can put it into my app?
My situation in more detail:
I'm thinking of porting to the iPad from OS X / rewriting from scratch for the iPad an app which manages lots of PDFs (journal articles, etc.), but I don't want to write the PDF reader part, because there are many good ones already out there; I don't want to reinvent the wheels.
(You might say you shouldn't reinvent pdf management apps, but I'd like to make one as a front end to SPIRES, and there isn't one so far.)
As the app would be a front end to a serious reading activity, UIWebView's pdf capability is not enough.
Also, users of my app would have various preferences which app to use.
That's the background behind my question. Thanks in advance!
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.
I'm building a carArray and want to filter the contents conditionally, using an NSPredicate, like so:
NSPredicate *pred;
switch (carType) {
case FreeCar:
pred = [NSPredicate predicateWithFormat:@"premium = NO"];
break;
case PremiumCar:
pred = [NSPredicate predicateWithFormat:@"premium = YES"];
break;
default:
pred = [NSPredicate predicateWithFormat:@"SOME PREDICATE THAT RETURNS EVERYTHING"];
break;
}
self.carArray = [aCarArrayIGotFromSomewhere filteredArrayUsingPredicate:pred];
My question is, what is the correct syntax for the value I've stubbed in as SOME PREDICATE THAT RETURNS EVERYTHING which returns all of the instances in the array / set?
PS - I know the answer and will post it immediately, just sharing it for everyone's reference as an earlier search on SO did not yield the result.
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?
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.
I have a CATiledLayer within a UIView and the UIView also contains a subview.
How can I make sure that the subview is always drawn above the layer?
Most of the time I get the tile layer covering the subview.
How can I enter RGB or Hex color values for backgrounds in Interface Builder? I can select predefined colors but I would like to manually enter in RGB values. Where can I do this?