Search Results

Search found 4899 results on 196 pages for 'ios newbie'.

Page 58/196 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • How to resize UILabel text after zooming UIScrollview zoomable

    - by netadictos
    I have an UIScrollview that is zoomable, the subview is one UIView (viewTexto) that contains an UILabel inside (messageLabel). This is the code - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollViewtmp{ return viewTexto; } -(void)scrollViewDidEndZooming:(UIScrollView *)scrollViewtmp withView:(UIView *)view atScale:(float)scale{ messageLabel.contentScaleFactor=scale; [scrollView setContentSize:CGSizeMake(scrollView.frame.size.width, messageLabel.frame.origin.y + messageLabel.frame.size.heightt)]; } With this code I can zoom, and the text is not blurry, there is no horizontal scroll but the size of the UILabel continues to be too large, so it is cut. I need that the width of the UILabel adopts to the scrollView width again as at the beginning. I have read any question about UIScrollViews in SO and having found exactly what I need.

    Read the article

  • UIView Login screen to tabbar logic

    - by Benjamin De Bos
    Folks, i'm having trouble with some navigation logic. Currently i have a simple two tabbed tabbar application. But i want to show a loginscreen in front. So that would be an UIView. Currently the code is as follows: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIViewController *viewController1 = [[roosterViewController alloc] initWithNibName:@"roosterViewController" bundle:nil]; UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; self.tabBarController = [[UITabBarController alloc] init]; self.tabBarController.viewControllers = @[viewController1, viewController2]; self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; return YES; } SO this pushes a simple tabcontroller. Well, now i want to have a login screen. So that would be a simple UIView which pushes the tabbar controller. But i can't seem to see the logic on how to do this. I've been trying to present a modal view controller, but the thing is: the tabbar will be loaded on the background. Since i need the username/password information to work on the tabbarview, this won't work. My Logic would be: delegate load loginViewController load tabbar controller But, then i need to be able to "logout". So i need to destroy the tabbar controller and present the login screen. Any thoughts on this?

    Read the article

  • ViewController access data

    - by Giovanni Filaferro
    Today i would ask you if there is a way to call a method of another view controller just not initializing it or just how to get that viewController as a global variable declared in .h file. Help me please. I'm using a PageViewController and I have to use a method of the contentViewController alredy initialized. here I create my ViewControllers: - (void)createTheContent { NSLog(@"createTheContent"); pageController = nil; //[pageController removeFromParentViewController]; //[pageController awakeFromNib]; NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:UIPageViewControllerSpineLocationMin] forKey: UIPageViewControllerOptionSpineLocationKey]; self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options: options]; pageController.dataSource = self; [[pageController view] setFrame:CGRectMake(0, 0, 320, 365)]; initialViewController = [self viewControllerAtIndex:0]; NSMutableArray *viewControllers = [NSArray arrayWithObject:initialViewController]; [pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil]; [self addChildViewController:pageController]; [[self view] addSubview:[pageController view]]; [pageController didMoveToParentViewController:self]; } here are my propertys in .h file: contentViewController *initialViewController; } //Page View Controller Properties @property (strong, nonatomic) UIPageViewController *pageController; @property (strong, nonatomic) NSArray *pageContent; @property (strong, nonatomic) NSMutableArray *pageStrings; @property (strong, nonatomic) id dataObject;

    Read the article

  • Why cannot change Monotouch.Dialog.TableView.Background color

    - by BlueSky
    Why cannot change MonoTouch.Dialog.TableView.Background color ? I am using the Elements API of MonoTouch.Dialog. It's still gray! class MyDialogViewController : DialogViewController { public MyDialogViewController (RootElement root) : base (root) { } public override void LoadView () { base.LoadView (); TableView.BackgroundColor = UIColor.Clear; UIImage background = UIImage.FromFile ("Mybackground.png"); ParentViewController.View.BackgroundColor = UIColor.FromPatternImage (background); } } public partial class MyVC: UINavigationController { public void CreateTestUI() { var menu = new RootElement("MyMenu"){ new Section ("test"){ new StringElement("Test", delegate() { }), ... var dv = new MyDialogViewController (menu) { Autorotate = true }; // add the nav controller to the window this.PushViewController (dv, true); } }

    Read the article

  • UITableViewCell imageView images loading small even when they are the correct size!

    - by Alex Barlow
    Im having an issue whilst loading images into a UITableViewCell after an asynchronous download and placement into an UIImage variable.. The images appear smaller than they actually are! But when scrolled down and scrolled back up to the image, or the whole table is reloaded, they appear at the correct size... Here is a code excerpt... - (void)reviewImageDidLoad:(NSIndexPath *)indexPath { ThumbDownloader *thumbDownloader = [imageDownloadsInProgress objectForKey:indexPath]; if (thumbDownloader != nil) { UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:thumbDownloader.indexPathInTableView]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.4]; [self.tableView cellForRowAtIndexPath:indexPath].imageView.alpha = 0.0; [UIView commitAnimations]; cell.imageView.image = thumbDownloader.review.thumb; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.4]; [self.tableView cellForRowAtIndexPath:indexPath].imageView.alpha = 1.0; [UIView commitAnimations]; } } Here is an image of the app just after calling this method.. http://www.flickr.com/photos/arbarlow/5288563627/ After calling tableView reloadData or scrolling around the appear correctly, go the the next flickr image, to see the normal result, but im sure you can guess that.. Does anyone have an ideas as to make the images appear correctly? im absolutely stumped?! Regards, Alex iPhone noob

    Read the article

  • Displaying Plist data into UItableview

    - by Christien
    I have a plist with Dictionary and numbers of strings per dictionary.show into the url below.and this list of items is in thousands in the plist. I need to display these plist data into the UItableview . How to do this? My Code: - (void)viewWillAppear:(BOOL)animated { // get paths from root direcory NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [documentPaths objectAtIndex:0]; NSString *documentPlistPath = [documentsDirectory stringByAppendingPathComponent:@"p.plist"]; NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:documentPlistPath]; valueArray = [dict objectForKey:@"title"]; self.mySections=[valueArray copy]; NSLog(@"value array %@",self.mySections); } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [self.mySections count]; } -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { NSString *key = [[self.mySections objectAtIndex:section]objectForKey:@"pass"]; return [NSString stringWithFormat:@"%@", key]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; } // Configure the cell... NSUInteger section = [indexPath section]; NSUInteger row = [indexPath row]; cell.textLabel.text = [[self.mySections objectAtIndex:row] objectForKey:@"title"]; cell.detailTextLabel.text=[[self.mySections objectAtIndex:section] objectForKey:[allKeys objectAtIndex:1]]; return cell; } Error is 2012-12-17 16:21:07.372 Project[2076:11603] * Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFArray objectAtIndex:]: index (4) beyond bounds (4)' * First throw call stack: (0x1703052 0x1523d0a 0x16aba78 0x16ab9e9 0x16fcc60 0x1d03a 0x391e0f 0x392589 0x37ddfd 0x38c851 0x337301 0x1704e72 0x277592d 0x277f827 0x2705fa7 0x2707ea6 0x2707580 0x16d79ce 0x166e670 0x163a4f6 0x1639db4 0x1639ccb 0x1505879 0x150593e 0x2f8a9b 0x2158 0x20b5) terminate called throwing an exceptionkill

    Read the article

  • Raw Video file from website

    - by Charlie
    I would like to make an app that will download videos files that can be played later. At first i thought I could have a UIWeb view and then try to access the cache of it and get the file that way but unfortunately i don't have access to that. After trying that my next thought would be get the direct link to the video file. Essentially what download helper does on fire fox. Any idea of where i could look at for help or any body have any better idea? Is there any stringByEvaluatingjavascript that might be of use or is there away to access the cache on a webview in your own app? Thanks for any help!

    Read the article

  • Conversion Fahrenheit to celsius programmatically

    - by Doom
    In my project, want to show the weather in fahrenheit first, then if the user wants clickes on conversion, needs to show the weather in celsius. My code is NSNumber *metric = [[NSUserDefaults standardUserDefaults] objectForKey:@"metric"]; NSLog(@"Metric is %@", metric); CGFloat aFloat = [speed floatValue]; CGFloat tFloat = [temperature floatValue]; CGFloat tempFloat = (tFloat-30)/2; NSNumber * p_Number = [NSNumber numberWithFloat:tempFloat]; //Convert mph to kmph if ([metric boolValue]) { [windValueLabel setText:[NSString stringWithFormat:@"%.2f kmph", aFloat * 1.6] ]; temperatureLabel.text = [NSString stringWithFormat:@"%@", p_Number]; } else{ [windValueLabel setText:[NSString stringWithFormat:@"%.2f mph", aFloat / 1.6]]; temperatureLabel.text = [NSString stringWithFormat:@"%@", temperature]; } When u start the app, its working and showing temperature in fahrenheit, but crashes at celsius man... is that the current conversion. help me out guys

    Read the article

  • Completion block not being called. How to check validity?

    - by HCHogan
    I have this method which takes a block, but that block isn't always called. See the method: - (void)updateWithCompletion:(void (^)(void))completion { [MYObject myMethodWithCompletion:^(NSArray *array, NSError *error) { if (error) { NSLog(@"%s, ERROR not nil", __FUNCTION__); completion(); return; } NSLog(@"%s, calling completion %d", __FUNCTION__, &completion); completion(); NSLog(@"%s, finished completion", __FUNCTION__); }]; } I have some more NSLogs inside completion. Sometimes this program counter just blows right past the call to completion() in the code above. I don't see why this would be as the calling code always passes a literal block of code as input. If you're curious of the output of the line containing the addressof operator, it's always something different, but never 0 or nil. What would cause completion not to be executed?

    Read the article

  • UIActionSheet With PickerView not showing up in iPad

    - by user717452
    I am using the following code to add an actionsheet with a picker view on it to my app. From the iPhone, it displays perfectly, but when viewing on iPad (Universal app), it shows a very small pickerview with none of the other buttons right on the center of the page. UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Select Chapter" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Select" otherButtonTitles:nil]; // Add the picker UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,185,0,0)]; pickerView.delegate = self; pickerView.showsSelectionIndicator = YES; // note this is default to NO [menu addSubview:pickerView]; [menu showFromTabBar:self.tabBarController.tabBar]; [menu setBounds:CGRectMake(0,0,320, 700)]; [pickerView release]; [menu release];

    Read the article

  • Unable to store NSNumber in core data

    - by Kamlesh
    Hi all, I am using Core Data in my application.I have an attribute named PINCode which has property Int64. Now,in my app I take the PIN code from a text field,convert it into NSNumber and try to store as an attribute value for an entity.But I am unable to do so.The exception that it shows on the console is:- Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "PINCode"; desired type = NSNumber; given type = NSCFString; value = 121.' Here is the code:- (Conversion to NSNumber):- NSString *str= txtPINCode.text; NSNumber *num = [[NSNumber alloc]init]; int tempNum = [str intValue]; num = [NSNumber numberWithInt:tempNum]; (Storing in core data entity):- NSManagedObjectContext *context = [appDelegate managedObjectContext]; NSManagedObject *newContact; newContact = [NSEntityDescription insertNewObjectForEntityForName:@"MemberTable" inManagedObjectContext:context]; [newContact setValue:num forKey:@"PINCode"]; The app crashes at this point.I am unable to find the reason of crash.I have also tried to check the conversion by the following code:- NSNumber *testNumber = [[NSNumber alloc]init]; id test = num; BOOL testMe = [test isKindOfClass:(Class)testNumber]; Can anybody help me with this?? Thanks in advance.

    Read the article

  • Using NSURLRequest+NSURLConnection seems overkill for a webcall with no data return

    - by Spectravideo328
    All, This might seems very straightforward but I have already gone through the URL loading system program guide and the various NSURL.... classes and not found my answer. I am just trying to do a simple call from the app to a website to reserve a party spot: NSString *path=[NSString stringWithFormat:@"http://www.myparty123.com/ireservedURL.asp?Nickname=%@&Seat=%i&Email=%@&Currentparty=%i",john,5432,[email protected],6598]; NSURL* reservationURL =[NSURL URLWithString:path]; NSData *call= [NSData dataWithContentsOfURL:reservationURL]; This seemed to be the simple way but I get this warning that I am not using the "call" variable. And it seems overkill to do a call using NSData where there is no data return. Yet, creating an NSURLRequest and initiating an NSURLConnection and then implementing delegates with that request seems to be overkill as well. What am I missing. Thanks KMB

    Read the article

  • UITapGestureRecognizer recognizing tap after scaling UIView

    - by Bikash Mishra
    I have a UIView which I scale to 4x after tapping on it. It works fine. On the next tap I want to restore it back to original size. The problem is that it recognizes the tap only in the smaller rectangle the UIView had before scaling. I would like to recognize the tap anywhere in the scaled UIView. How can I achieve it? //Tapping code titleCard = [[UIView alloc] initWithFrame: myrect]; [self addSubview:titleCard]; [titleCard release]; UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(changeSize:)]; [tapRecognizer setNumberOfTouchesRequired:1]; [tapRecognizer setNumberOfTapsRequired:1]; [titleCard addGestureRecognizer:tapRecognizer]; [tapRecognizer release]; //Scaling code CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; [scale setBeginTime:CACurrentMediaTime()+0.75]; [scale setDuration:0.5]; [scale setToValue: [NSNumber numberWithFloat:4.0f]]; [scale setRemovedOnCompletion:NO]; [scale setFillMode:kCAFillModeForwards]; Thanks.

    Read the article

  • UIPopover Sizing

    - by Echilon
    I have a UIPopoverController which I'm trying to show from a UIBarButtonItem in a navigation bar. Despite setting the resizing mask for the tableview inside the popover's content viewController, it takes up the whole height of the screen. The only thing which has any effect on the content size is menuPopover.contentViewController.view setFrame:CGRect. I'm using the code below to show the popover inside the left hand side of a UISplitViewController // menuPopover and editVc are properties on the parent viewController menuPopover = [[UIPopoverController alloc] initWithContentViewController:editVc]; [menuPopover presentPopoverFromBarButtonItem:btnMenu permittedArrowDirections:UIPopoverArrowDirectionAny animated:true]; [menuPopover setPopoverContentSize:CGSizeMake(400, 500) animated:true]; [menuPopover.contentViewController.view setFrame:CGRectMake(0,0,400, 500)]; Yet this is what I'm seeing. The arrow shows where the menu button was which showed the popover: http://imageshack.us/photo/my-images/545/screenshot20120312at191.png/ It's as though the content view is just expanding vertically.

    Read the article

  • UIAlert View Objective C - Opening app store link

    - by benhowdle89
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"An Alert!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301349397&amp;amp;amp;amp;mt=8"]];]; [alert show]; [alert release]; I'm trying to display a UIAlertView with one "Ok" button and one "Buy Full Version" button. How can i make the above code work? Thanks

    Read the article

  • iphone SDK: How to check user set up a valid IP , Netmask , Router ???

    - by WebberLai
    It is simple to understand after this pic. I add fewtextfields in tableview I already set the keyboard style is number pad. Now the problems is 1.Do I need to create 12 textfields ???ex. UITextField *ip1,ip2,ip3,ip4....or just set different tag for textfield ? 2.How to check user enter wrong char not 3 valid numbers (even the keyboard is set number pad,but it might can paste words...) 3.How to check user did follow this setting rules ??? <1If IP1 is 0~223 , IP2 need to be set 0~255,IP3,IP4 both are 0~255 <2If IP1 is 172 ,IP2 is set 16~31.IP3,IP4 both are 0~255; If IP1 is 192 ,IP2 must be 168.IP3 IP4 are 0~255 <3Netmask set default 255.255.255.0 <4Router 0~223 ,0~255 ,0~255 ,0~255 This IP setting rules is my friends tech me this ...I not sure the rules is right or not?

    Read the article

  • measure rendered html in javascript without affecting the measurement

    - by drawnonward
    I am doing pagination in javascript. This is typographic pagination, not chopping up database results. For the most part it works, but I have run into a heisenberg issue where I cannot quite measure text without affecting it. I am not trying to measure text before it is rendered. I want the actual position it shows up at on screen, so I can paginate to where it is naturally wrapped. I am measuring the vertical position of characters, not the horizontal width of strings. The way I do this is similar to this answer in that I am applying a style to a block of text, then measuring the position of the newly created span. If the span does not reach the end of the page, I clear it and make a new span in a linear search. The problem is that the anti-aliased sub-pixel text layout is different when the span is applied. In rare cases, this causes the text to wrap differently when I measure it. I have only seen this when wrapping at a hyphen, and I assume it would not happen when wrapping at white space. As a concrete example, "prepared-he" is the string I am having trouble with. When I measure up to "prepare" it appears, as expected, to be within the current page. When I measure "prepared" the whole phrase wraps down to the next line, moving it to the next page, so it looks like the "d" is the character to break at. I break the text between "prepare" and "d-he" and that is wrong. Trying to evaluate individual characters opens a whole can of worms I would rather avoid. The wrapping changes because, with the new span, the line is 1 pixel wider. A solution to my problem could either be a better way to measure text using javascript, or a way to wrap text in a new element without affecting layout. I have tried setting margin-right:-1px for the class of the span being created to wrap the text. This had no noticeable effect. I am doing this in a UIWebView on the iPhone. There are some measurement related calls that are available in normal WebKit that are not available here. For example, Range does not have getBoundingClientRect or support setting an offset other than 0 in setStart or setEnd. Thank you

    Read the article

  • curios about CCSpriteBatchNode's addchild method

    - by lzyy
    when diving into "learn cocos2d game development with ios5", in ch08 in EnemyCache.m -(id) init { if ((self = [super init])) { // get any image from the Texture Atlas we're using CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"monster-a.png"]; batch = [CCSpriteBatchNode batchNodeWithTexture:frame.texture]; [self addChild:batch]; [self initEnemies]; [self scheduleUpdate]; } return self; } so batch is with texture "monster-a.png" in EnemyEntity.m's initWithType method switch (type) { case EnemyTypeUFO: enemyFrameName = @"monster-a.png"; bulletFrameName = @"shot-a.png"; break; case EnemyTypeCruiser: enemyFrameName = @"monster-b.png"; bulletFrameName = @"shot-b.png"; shootFrequency = 1.0f; initialHitPoints = 3; break; case EnemyTypeBoss: enemyFrameName = @"monster-c.png"; bulletFrameName = @"shot-c.png"; shootFrequency = 2.0f; initialHitPoints = 15; break; default: [NSException exceptionWithName:@"EnemyEntity Exception" reason:@"unhandled enemy type" userInfo:nil]; } if ((self = [super initWithSpriteFrameName:enemyFrameName])) { //... } so the returned object may be in 3 different frame. since Only the CCSprites that are contained in that texture can be added to the CCSpriteBatchNode, obviously, 'monster-b.png' is not contained in 'monster-a.png', why the different enemy can still be added to the batch?

    Read the article

  • unicode data with custom font doesn't work properly in ipad

    - by David Ohanyan
    I am using custom font for label and string which I am getting from unicode characters. And the font is not changing. here is the snippet of my code: NSString* str = @"\u05D0\u05D1\u05D2"; [mMatchingLabel setText:str]; mMatchingLabel.font = [UIFont fontWithName:@"David New Hebrew" size:26]; But when I write for example : NSString* str = @"label"; [mMatchingLabel setText:str]; mMatchingLabel.font = [UIFont fontWithName:@"David New Hebrew" size:26]; The font effect is evident. Can someone explain what's here wrong?

    Read the article

  • addObjectsFromArray

    - by derek.lo
    I have a question about memory management when using the addObjectsFromArray method. Basically, I have 2 arrays defined in the appDelegate. I need these 2 arrays for the duration of my application's runtime. I therefore release them in my appDelegate's dealloc method. When I go to use these two arrays in a class, I want one array to store the values from the other, so that the other can have it's contents removed, but still stick around for use. Something like this: [appDelegate.arrayTwo addObjectsFromArray:appDelegate.arrayOne]; [appDelegate.arrayOne removeAllObjects]; I'm getting the compiler error: EXC_BAD_ACCESS because of a pointer issue? retaining issue? Any help would be greatly appreciated! Thanks

    Read the article

  • Code to show UIPickerview under clicked UITextField

    - by Chris F
    I thought I'd share a code snippet where I show a UIPickerView when you click a UITextField. The code uses a UIPickerView, but there's no reason to use a different view controller, like a UITableViewController that uses a table instead of a picker. Just create a single-view project with a nib, and add a UITextField to the view and make you connections in IB. // .h file #import @interface MyPickerViewViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource, UITextFieldDelegate> - (IBAction)dismissPickerView:(id)sender; @end // .m file #import "MyPickerViewViewController.h" @interface MyPickerViewViewController () { UIPickerView *_pv; NSArray *_array; IBOutlet __weak UITextField *_tf; BOOL _pickerViewShown; } @end @implementation MyPickerViewViewController - (void)viewDidLoad { [super viewDidLoad]; _pickerViewShown = NO; _array = [NSArray arrayWithObjects:@"One", @"Two", @"Three", @"Four", nil]; _pv = [[UIPickerView alloc] initWithFrame:CGRectZero]; _pv.showsSelectionIndicator = YES; _pv.dataSource = self; _pv.delegate = self; _tf.delegate = self; _tf.inputView = _pv; } - (IBAction)dismissPickerView:(id)sender { [_pv removeFromSuperview]; [_tf.inputView removeFromSuperview]; [_tf resignFirstResponder]; _pickerViewShown = NO; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { if (!_pickerViewShown) { [self setRectForPickerViewRelativeToTextField:textField]; [self.view addSubview:_tf.inputView]; _pickerViewShown = YES; } else { [self dismissPickerView:self]; } return NO; } - (void)setRectForPickerViewRelativeToTextField:(UITextField*)textField { CGFloat xPos = textField.frame.origin.x; CGFloat yPos = textField.frame.origin.y; CGFloat width = textField.frame.size.width; CGFloat height = textField.frame.size.height; CGFloat pvHeight = _pv.frame.size.height; CGRect pvRect = CGRectMake(xPos, yPos+height, width, pvHeight); _pv.frame = pvRect; } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { return [_array objectAtIndex:row]; } - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return _array.count; } - (void) pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { _tf.text = [_array objectAtIndex:row]; [self dismissPickerView:self]; } @end

    Read the article

  • Hide buttons when making a screenshot UIGraphicsBeginImageContextWithOptions

    - by Jan
    is there a way to hide specific buttons (IBAction) when making a screenshot with UIGraphicsBeginImageContextWithOptions ? I'm using the code below: // Define the dimensions of the screenshot you want to take (the entire screen in this case) UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *sourceImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //now we will position the image, X/Y away from top left corner to get the portion we want UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0); [sourceImage drawAtPoint:CGPointMake(0, -20)]; UIImage *croppedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(croppedImage,nil, nil, nil); Thank you for your answer!

    Read the article

  • NSFetchedResultsController doesn't fetch up the child-parent moc chain?

    - by Kronusdark
    I cannot find any clarification on this, so it may be a bug. Problem is, I have a series of parent-child Managed Object Context's. When I save on a child context the changes get pushed up to the parent, and I can fetch using a plain old NSFetchRequest. However, if I rely on an NSFetchedResultsController to pull these changes into a sibling context to the first, they do not see them. calling -(void)performFetch: error; doesn't seem to pull the changes either. After a restart of the app, all new data is available. My hypothesis is that NSFetchedResultsController only fetches from its current context and will not follow the chain to the persistent store. Can someone please set me straight here? Am I going to have to use notifications to monitor changes on other contexts? and finally, is this mentioned somewhere in the doc's? I cannot find it for the life of me.

    Read the article

  • How to disable other touch gestures after adding another tap gesture to the view?

    - by Hudson Duan
    I have a view with some tables and buttons on it, and then I want to add a tap gesture to the entire view, but I only want that gesture recognizer to recognize taps. Ideally, I want to do something when the added gesture recognizer is tapped, then remove that gesture recognizer after so the other buttons and tables can be accessed. Basically a tap to dismiss functionality that replicates something like the facebook notifications window, tap outside to dismiss, but not interfere with the buttons outside of the notifications view. Can anybody help? My current code is: NotificationsWindow *customView = [[[NSBundle mainBundle]loadNibNamed:@"NotificationsWindow" owner:self options:nil]objectAtIndex:0]; customView.frame= CGRectMake(12, 12, customView.frame.size.width, customView.frame.size.height); UITapGestureRecognizer *recognizerForSubView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehindAgain:)]; [recognizerForSubView setNumberOfTapsRequired:1]; recognizerForSubView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView addGestureRecognizer:recognizerForSubView]; [self.view addSubview:customView]; UITapGestureRecognizer *recognizerForSuperView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)]; [recognizerForSuperView setNumberOfTapsRequired:1]; recognizerForSuperView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView.superview addGestureRecognizer:recognizerForSuperView]; (void)handleTapBehind:(UITapGestureRecognizer *)sender { NSLog(@"tapped"); [[self.view.subviews lastObject] removeFromSuperview]; [self.view removeGestureRecognizer:sender]; } I want to make it so that the recognizer for the super view dismisses the subview, but not to interfere with the other taps on the super view.

    Read the article

  • Adding ivars to NSManagedObject subclass

    - by The Crazy Chimp
    When I create an entity using core data then generate a subclass of NSManagedObject from it I get the following output (in the .h): @class Foo; @interface Foo : NSManagedObject @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSSet *otherValues; @end However, in my .m file I want to make use of the name and otherValues values. Normally I would simply create a couple of ivars and then add the properties for them as I required. That way I can access them in my .m file easily. In this situation would it be acceptable to do this? Would adding ivars to the .h (for name and otherValues) cause any unusual behaviour in the persistance & retrieval of objects?

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >