Search Results

Search found 1125 results on 45 pages for 'uiview'.

Page 13/45 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • iPhone Tab Bar App With Registration View

    - by leeks
    Hi! I'm a relative newbie on iPhone app development but have successfully created a tab bar app with 4 tab bar items. I would like to have a one-off registration page for users to key-in information when they open the application for the first time. The registration page should load before the view with the selection of tab bar items loads. What is the best way to do this? Also, how do I load a UIView or UIWebView before the tab bar items load? Any suggestions and sample code would be very much appreciated - thanks!

    Read the article

  • Implementing ZBar QR Code Reader in UIView

    - by Bobster4300
    I really need help here. I'm pretty new to iOS/Objective-C so sorry if the problem resolution is obvious or if my code is terrible. Be easy on me!! :-) I'm struggling to integrate ZBarSDK for reading QR Codes into an iPad app i'm building. If I use ZBarReaderController (of which there are plenty of tutorials and guides on implementing), it works fine. However I want to make the camera come up in a UIView as opposed to the fullscreen camera. Now I have gotten as far as making the camera view (readerView) come up in the UIView (ZBarReaderView) as expected, but I get an error when it scans a code. The error does not come up until a code is scanned making me believe this is either delegate related or something else. Here's the important parts of my code: (ZBarSDK.h is imported at the PCH file) SignInViewController.h #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @class AVCaptureSession, AVCaptureDevice; @interface SignInViewController : UIViewController < ZBarReaderDelegate > { ZBarReaderView *readerView; UITextView *resultText; } @property (nonatomic, retain) UIImagePickerController *imgPicker; @property (strong, nonatomic) IBOutlet UITextView *resultText; @property (strong, nonatomic) IBOutlet ZBarReaderView *readerView; -(IBAction)StartScan:(id) sender; SignInViewController.m #import "SignInViewController.h" @interface SignInViewController () @end @implementation SignInViewController @synthesize resultText, readerView; -(IBAction)StartScan:(id) sender { readerView = [ZBarReaderView new]; readerView.readerDelegate = self; readerView.tracksSymbols = NO; readerView.frame = CGRectMake(30,70,230,230); readerView.torchMode = 0; readerView.device = [self frontFacingCameraIfAvailable]; ZBarImageScanner *scanner = readerView.scanner; [scanner setSymbology: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0]; [self relocateReaderPopover:[self interfaceOrientation]]; [readerView start]; [self.view addSubview: readerView]; resultText.hidden=NO; } - (void) readerControllerDidFailToRead: (ZBarReaderController*) reader withRetry: (BOOL) retry{ NSLog(@"the image picker failing to read"); } - (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info { NSLog(@"the image picker is calling successfully %@",info); id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults]; ZBarSymbol *symbol = nil; NSString *hiddenData; for(symbol in results) hiddenData=[NSString stringWithString:symbol.data]; NSLog(@"the symbols is the following %@",symbol.data); resultText.text=symbol.data; NSLog(@"BARCODE= %@",symbol.data); NSLog(@"SYMBOL : %@",hiddenData); resultText.text=hiddenData; } The error I get when a code is scanned: 2012-12-16 14:28:32.797 QRTestApp[7970:907] -[SignInViewController readerView:didReadSymbols:fromImage:]: unrecognized selector sent to instance 0x1e88b1c0 2012-12-16 14:28:32.799 QRTestApp[7970:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SignInViewController readerView:didReadSymbols:fromImage:]: unrecognized selector sent to instance 0x1e88b1c0' I'm not too worried about what happens with the results just yet, just want to get over this error. Took me ages just to get the camera to come up in the UIView due to severe lack of tutorial or documentation on ZBarReaderView (for beginners anyway). Thanks all.

    Read the article

  • Hidden UIView Orientation Change / Layout problems

    - by gargantaun
    The Problem: I have two View Controllers loaded into a root View Controller. Both sub view layouts respond to orientation changes. I switch between the two views using [UIView transformationFromView:...]. Both sub views work fine on their own, but if... Views are swapped Orientation Changes Views are swapped again the View that was previously hidden has serious layout problems. The more I repeat these steps the worse the problem gets. Implementation Details I have three viewsControllers. MyAppViewController A_ViewController B_ViewController A & B ViewControllers have a background image each, and a UIWebView and an AQGridView respectively. To give you an example of how i'm setting it all up, here's the loadView method for A_ViewController... - (void)loadView { [super loadView]; // background image // Should fill the screen and resize on orientation changes UIImageView *bg = [[UIImageView alloc] initWithFrame:self.view.bounds]; bg.contentMode = UIViewContentModeCenter; bg.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; bg.image = [UIImage imageNamed:@"fuzzyhalo.png"]; [self.view addSubview:bg]; // frame for webView // Should have a margin of 34 on all sides and resize on orientation changes CGRect webFrame = self.view.bounds; webFrame.origin.x = 34; webFrame.origin.y = 34; webFrame.size.width = webFrame.size.width - 68; webFrame.size.height = webFrame.size.height - 68; projectView = [[UIWebView alloc] initWithFrame:webFrame]; projectView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; [self.view addSubview:projectView]; } For the sake of brevity, the AQGridView in B_ViewController is set up pretty much the same way. Now both these views work fine on their own. However, I use both of them in the AppViewController like this... - (void)loadView { [super loadView]; self.view.autoresizesSubviews = YES; [self setWantsFullScreenLayout:YES]; webView = [[WebProjectViewController alloc] init]; [self.view addSubview:webView.view]; mainMenu = [[GridViewController alloc] init]; [self.view addSubview:mainMenu.view]; activeView = mainMenu; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(switchViews:) name:SWAPVIEWS object:nil]; } and I switch betweem the two views using my own switchView method like this - (void) switchViews:(NSNotification*)aNotification; { NSString *type = [aNotification object]; if ([type isEqualToString:MAINMENU]){ [UIView transitionFromView:activeView.view toView:mainMenu.view duration:0.75 options:UIViewAnimationOptionTransitionFlipFromRight completion:nil]; activeView = mainMenu; } if ([type isEqualToString:WEBVIEW]) { [UIView transitionFromView:activeView.view toView:webView.view duration:0.75 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil]; activeView = webView; } // These don't seem to do anything //[mainMenu.view setNeedsLayout]; //[webView.view setNeedsLayout]; } I'm fumbling my way through this, and I suspect a lot of what i've done is implemented incorrectly so please feel free to point out anything that should be done differently, I need the input. But my primary concern is to understand what's causing the layout problems. Here's two images which illustrate the nature of the layout issues... UPDATE: I just noticed that when the orientation is landscape, the transition flips vertically, when I would expect it to be horizontal. I don't know wether that's a clue as to what might be going wrong. Switch to the other view... change orientation.... switch back....

    Read the article

  • Pop-up modal with UITableView on iPhone

    - by Meltemi
    I need to pop up a quick dialog for the user to select one option in a UITableView from a list of roughly 2-5 items. Dialog will be modal and only take up about 1/2 of screen. I go back and forth between how to handle this. Should I subclass UIView and make it a UITableViewDelegate & DataSource? I'd also prefer to lay out this view in IB. So to display I'd do something like this from my view controller (assume I have a property in my view controller for DialogView *myDialog;) NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"DialogView" owner:myDialog options:nil]; myDialog = [nibViews objectAtIndex:0]; [self.view addSubview:myDialog]; problem is i'm trying to pass owner:myDialog which is nil as it hasn't been instantiated...i could pass owner:self but that would make my view controller the File's Owner and that's not how that dialog view is wired in IB. So that leads me to think this dialog wants to be another full blown UIViewController... But, from all I've read you should only have ONE UIViewController per screen so this confuses me because I could benefit from viewDidLoad, etc. that come along with view controllers... Can someone please straighten this out for me?

    Read the article

  • NSString sizeWithFont: returning inconsistent results? known bug?

    - by Olof Hedman
    I'm trying to create a simple custom UIView wich contain a string drawn with a single font, but where the first character is slightly larger. I thought this would be easily implemented with two UILabel:s placed next to eachother. I use NSString sizeWithFont to measure my string to be able to lay it out correctly. But I noticed that the font baseline in the returned rectangle varies with +/- 1 pixel depending on the font size I set. Here is my code: NSString* ctxt = [text substringToIndex:1]; NSString* ttxt = [text substringFromIndex:1]; CGSize sz = [ctxt sizeWithFont: cfont ]; clbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, sz.width, sz.height)]; clbl.text = ctxt; clbl.font = cfont; clbl.backgroundColor = [UIColor clearColor]; [contentView addSubview:clbl]; CGSize sz2 = [ttxt sizeWithFont: tfont]; tlbl = [[UILabel alloc] initWithFrame:CGRectMake(sz.width, (sz.height - sz2.height), sz2.width, sz2.height)]; tlbl.text = ttxt; tlbl.font = tfont; tlbl.backgroundColor = [UIColor clearColor]; [contentView addSubview:tlbl]; If I use 12.0 and 14.0 as sizes, it works fine. But if I instead use 13.0 and 15.0, then the first character is 1 pixel too high. Is this a known problem? Any suggestions how to work around it? Creating a UIWebView with a CSS and HTML page seems way overkill for this. and more work to handle dynamic strings. Is that what I'm expected to do?

    Read the article

  • UIScrollview calling superviews layoutSubviews when scrolling?

    - by marchinram
    Hello, I added a UITableView as a subview to a custom UIView class I'm working on. However I noticed that whenever I scroll the table it calls my classes layoutSubviews. I'm pretty sure its the UIScrollview that the table is inheriting from which is actually doing this but wanted to know if there is a way to disable this functionality and if not why is it happening? I don't understand why when you scroll a scrollview it needs its superview to layout its subviews. Code: @implementation CustomView - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.clipsToBounds = YES; UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0, 15.0, 436.0, 132.0) style:UITableViewStylePlain]; tableView.dataSource = self; tableView.delegate = self; tableView.separatorStyle = UITableViewCellSeparatorStyleNone; tableView.backgroundColor = [UIColor clearColor]; tableView.showsVerticalScrollIndicator = NO; tableView.contentInset = UIEdgeInsetsMake(kRowHeight, 0.0, kRowHeight, 0.0); tableView.tag = componentIndex; [self addSubview:tableView]; [tableView release]; } return self; } - (void)layoutSubviews { // This is called everytime I scroll the tableview } @end

    Read the article

  • Cannot show scene with Cocos2D when using UITabBarController

    - by gw1921
    Hi I'm new to Cocos2D but am having serious issues when trying to load a cocos scene in one of the UIViewControllers mixed with other normal UIKit UIViewControllers. My project uses a UITabBarController to manage four view controllers. Three are normal UIKit view controllers while one of them I want to use cocos2D for (to draw some sprites and animate them). The following is what I've done so far. In the applicationDidFinishLaunching method, I initialize cocos2D to use the window and take the first tabbarcontroller view: - (void)applicationDidFinishLaunching:(UIApplication *)application { if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] ) { [CCDirector setDirectorType:CCDirectorTypeDefault]; } [[CCDirector sharedDirector] setPixelFormat:kPixelFormatRGBA8888]; [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888]; [[CCDirector sharedDirector] setDisplayFPS:YES]; [[CCDirector sharedDirector] attachInView: window]; [[[CCDirector sharedDirector] openGLView] addSubview: tabBarController.view]; [window makeKeyAndVisible]; } Then in the third UIViewController code (where I want to use cocos2D) I do this (note: the view is being loaded from a NIB file which has a blank UIView and nothing else):\ - (void)viewDidLoad { [super viewDidLoad]; // 'scene' is an autorelease object. CCScene *myScene = [CCScene node]; // 'layer' is an autorelease object. MyLayer *myLayer = [MyLayer node]; // add layer as a child to scene [myScene addChild: myLayer]; [[CCDirector sharedDirector] runWithScene: myScene]; } However all I see is a blank white view and nothing else. If I call the following in viewdidLoad: [[CCDirector sharedDirector] attachInView: self.view]; The app crashes complaining that CCDirector is already attached. Please help!

    Read the article

  • How does the overall view hierarchy change when using UIKit view manipulations?

    - by executor21
    I've been trying to figure out what happens in the view hierarchy when methods like pushViewController:animated, presentModalViewController:animated, and tab switches in UITabBarViewController are used, as well as UIAlertView and UIActionSheet. (Side note: I'm doing this because I need to know whether a specific UIView of my creation is visible on screen when I do not know anything about how it or its superview may have been added to the view hierarchy. If someone knows a good way to determine this, I'd welcome the knowledge.) To figure it out, I've been logging out the hierarchy of [[UIApplication sharedApplication] keyWindow] subviews in different circumstances. Is the following correct: When a new viewController is pushed onto the stack of a UINavigationController, the old viewController's view is no longer in the view hierarchy. That is, only the top view controller's view is a subview of UINavigationController's view (according to logs, it's actually several private classes such as UILayoutContainerView). Are the views of view controllers below the top controller of the stack actually removed from the window? A very similar thing happens when a new viewController is presented via presentModalViewController:animated. The new viewController's view is the only subview of the kew window. Is this correct? The easiest thing to understand: a UIAlertView creates its own window and makes it key. The strangest thing I encountered: a UIActionSheet is shown via showInView: method, the actionSheet isn't in the view hierarchy at all. It's not a subview of the view passed as an argument to showInView:, it isn't added as a subview of the key window, and it doesn't create its own window. How does it appear, then? I haven't tried this yet, so I'd like to know what happens in the keyWindow hierarchy when tabs in a UITabBarController are switched. Is the view of the selected UIViewController moved to the top, or does it work like with pushViewController:animated and presentModalViewController:animated, where only the displayed view is in the window hierarchy?

    Read the article

  • Inactive area after device rotation

    - by Sébastien
    Hi all, I don't understand what's wrong in my very simple application with device rotation : I built my view with interface builder. (See screen capture here) I specified <key>UIInterfaceOrientation</key><string>UIInterfaceOrientationLandscapeRight</string> in my info.plist file. I had a (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {return YES;} in my root view controller. The area on the left (shown in red on the capture), around 20 pixel width, keeps inactive (nothing append if I hit a button in this area). In fact the full screen is active only in portrait mode, in landscape right mode there is this 20 pixels width inactive area, in landscape left mode this inactive area is on the right, in portrait upside down mode this area is on the bottom. I read lots of posts and documentation about UIView rotation, but I did not find anything to solve this problem (I tried to play with view.frame and view.bounds without any success). Anybody has an idea ? Thanks a lot. Regards. Sébastien.

    Read the article

  • Custom UILabel does not show text.

    - by Oscar
    Hi! I've made an custom UILabel class in which i draw a red line at the bottom of the frame. The red line is showing but i cant get the text to show. #import <UIKit/UIKit.h> @interface LetterLabel : UILabel { } @end #import "LetterLabel.h" @implementation LetterLabel - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 2.0); CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0); CGContextBeginPath(UIGraphicsGetCurrentContext()); CGContextMoveToPoint(UIGraphicsGetCurrentContext(), 0.0, self.frame.size.height); CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), self.frame.size.width, self.frame.size.height); CGContextStrokePath(UIGraphicsGetCurrentContext()); } - (void)dealloc { [super dealloc]; } @end #import <UIKit/UIKit.h> #import "Word.h" @interface WordView : UIView { Word *gameWord; } @property (nonatomic, retain) Word *gameWord; @end @implementation WordView @synthesize gameWord; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundColor = [UIColor whiteColor]; LetterLabel *label = [[LetterLabel alloc] initWithFrame:CGRectMake(0, 0, 20, 30)]; label.backgroundColor = [UIColor cyanColor]; label.textAlignment = UITextAlignmentCenter; label.textColor = [UIColor blackColor]; [label setText:@"t"]; [self addSubview:label]; } return self; } - (void)drawRect:(CGRect)rect { // Drawing code } - (void)dealloc { [gameWord release]; [super dealloc]; } @end

    Read the article

  • The best way to implement drawing features like Keynote

    - by Shamseddine
    Hi all, I'm trying to make a little iPad tool's for drawing simple geometrical objects (rect, rounded rect, ellipse, star, ...). My goal is to make something very close to Keynote (drawing feature), i.e. let the user add a rect (for instance), resizing it and moving it. I want too the user can select many objects and move them together. I've thought about at least 3 differents ways to do that : Extends UIView for each object type, a class for Rect, another for Ellipse, ... With custom drawing method. Then add this view as subview of the global view. Extends CALayer for each object type, a class for Rect, another for Ellipse, ... With custom drawing method. Then add this layer as sublayer of the global view layer's. Extends NSObject for each object type, a class for Rect, another for Ellipse, ... With just a drawing method which will get as argument a CGContext and a Rect and draw directly the form in it. Those methods will be called by the drawing method of the global view. I'm aware that the two first ways come with functions to detect touch on each object, to add easily shadows,... but I'm afraid that they are a little too heavy ? That's why I thought about the last way, which it seems to be straight forward. Which way will be the more efficient ??? Or maybe I didn't thought another way ? Any help will be appreciated ;-) Thanks.

    Read the article

  • Cocoa Touch: Creating and Adding Custom View

    - by Jason
    I create a custom view in cocoa touch that is superclassed by UIView and in my main controller I initialize it and then add it as a subview to the main view, but when I add it to the main view it calls my initializer method again and causes an infinite loop. Am I going about creating my custom view wrong? Here is the mainView (void)loadView { UIImage *tempImage = [UIImage imageNamed: @"image1.jpg"]; CustomImageContainer *testImage = [[CustomImageContainer alloc] initWithImage: tempImage andLabel: @"test image" onTop: true atX: 10 atY: 10]; [self.view addSubview: testImage]; } and the CustomImageContainer -(CustomImageContainer *) initWithImage: (UIImage *)imageToAdd andLabel: (NSString *)text onTop: (BOOL) top atX: (int) x_cord atY: (int) y_cord{ UIImageView *imageview_to_add = [[UIImageView alloc] initWithImage: imageToAdd]; imageview_to_add.frame = CGRectMake(0, 0, imageToAdd.size.width, imageToAdd.size.height); UILabel *label_to_add = [[UILabel alloc] init]; label_to_add.text = text; label_to_add.alpha = 50; label_to_add.backgroundColor = [UIColor blackColor]; label_to_add.textColor = [UIColor whiteColor]; [self addSubview: imageview_to_add]; self.frame = CGRectMake(x_cord, y_cord, imageToAdd.size.width, imageToAdd.size.height); if (top) { label_to_add.frame = CGRectMake(0, 0, imageview_to_add.frame.size.width, imageview_to_add.frame.size.height); //[self addSubview: label_to_add]; } else { label_to_add.frame = CGRectMake(0,.2 * imageview_to_add.frame.size.height, imageview_to_add.frame.size.width, imageview_to_add.frame.size.height); } [self addSubview: label_to_add]; [super init]; return self; }

    Read the article

  • Loading UITableView form UIView

    - by Amarpreet
    Hi Guys, I am working on navigation based application in which i can navigate to many views starting from default UITableView which is starting view in application template. I have added another UIView and added tableView control on that UIView. I am calling that view form one of the many views on a button click. Its showing the view but not populating the data in the table. And I also want to handle the event when user taps on the cell of the table of that view. Below is the Code I am using on button click: if(self.lstView == nil) { ListViewController *viewController = [[ListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; self.lstView = viewController; [viewController release]; } [self.navigationController pushViewController:lstView animated:YES]; self.lstView.title = @"Select";//@"System"; [self.lstView.tblList.dataSource fillList]; Below is the fillList function code: -(NSArray *)fillList { NSArray *tempArray = [[[NSArray alloc] initWithObjects:@"Item 1" , @"Item 2" , nil]autorelease]; return tempArray; } I am pretty new in Iphone programming and don't have much understanding. Helping with detailed description and code will be highly appreciated. Thanks.

    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

  • Added CAGradientLayer, getting this in my UIView dealloc: [CALayer release]: message sent to deallocated instance

    - by developerdoug
    Here there, I have a custom UIView. This view acts as a activity indicator but as label above the UIActivityIndicatorView. In the init, I add a CAGradientLayer. I allocate and initialize it and insert it at index 0 as a sublayer of the UIView layer property. In my dealloc method was called, I received a message in the console: - [CALayer release]: message sent to deallocated instance. My code: @interface LabelActivityIndicatorView () { UILabel *_label; UIActivityIndicatorView *_activityIndicatorView; CAGradientLayer *_gradientLayer; } @end @implementation LabelActivityIndicatorView //dealloc - (void) dealloc { [_label release]; [_activityIndicatorView release]; //even tried to remove the layer [_gradientLayer removeFromSuperLayer]; [_gradientLayer release]; [super dealloc]; } // init - (id) initWithFrame:(CGRect)frame { if ( (self = [super initWithFrame:frame]) ) { // init the label // init the gradient layer _gradientLayer = [[CAGradientLayer alloc] init]; [_gradientLayer setBounds:[self bounds]]; [_gradientLayer setPosition:CGPointMake(frame.size.width/2, frame.size.height/2)]; [[self layer] insertSublayer:_gradientLayer atIndex:0]; [[self layer] setNeedsDisplay]; } return self; } @end Anyone have any ideas. Since I'm allocating and initializing the gradient layer I'm responsible for releasing it. I should be able to alloc and init and assign to some ivar. Perhaps I should create a property with retain on it. Thanks,

    Read the article

  • UIScrollView -> UIView ->UIImageView

    - by RapidM
    Hi everyone, I am trying to create a horizontal UIScrollView with a few images in it. The user should be able to scroll horizontal between all the images. If he holds down the finger the scrolling should stop. I though about making a UIScrollView (320 x 122 px) UIView for the content + really big width UIImageView for the individual images Here is my code: headScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 122)]; [self.view addSubview:headScrollView]; // Dafür einen contentView programmatisch festlegen headContentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, headScrollView.frame.size.height)]; [headContentView setBackgroundColor:[UIColor lightGrayColor]]; [headScrollView addSubview:headContentView]; [headScrollView setContentSize:headContentView.frame.size]; headImageView = [[UIImageView alloc] init]; NSMutableArray *elements = [appDelegate getElements]; for (int i = 0; i < [elements count]; i++) { headImageView.image = [UIImage imageNamed:[[elements objectAtIndex:i] nameOfElement]]; [headContentView addSubview:headImageView]; } But it's not working. There is no image there :-( When I do a NSLOG i get 3 names of the images, so it should work... Any ideas? Thanks!

    Read the article

  • How can I use this animation code?

    - by O.C.
    I'm a newbie and I need some help. I want to display a popup image over a given UIView, but I would like it to behave like the UIAlertView or like the Facebook Connect for iPhone modal popup window, in that it has a bouncy, rubbber-band-like animation to it. I found some code on the net from someone who was trying to do something similar. He/she put this together, but there was no demo or instructions. Being that I am so new, I don't have any idea as to how to incorporate this into my code. This is the routine where I need the bouncy image to appear: - (void) showProductDetail { . . . //////////////////////////////////////////////////////////////////////// // THIS IS A STRAIGHT SCALE ANIMATION RIGHT NOW. I WANT TO REPLACE THIS // WITH A BOUNCY RUBBER-BAND ANIMATION _productDetail.transform = CGAffineTransformMakeScale(0.1,0.1); [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; _productDetail.transform = CGAffineTransformMakeScale(1,1); [UIView commitAnimations]; } . . . } This is the code I found: float pulsesteps[3] = { 0.2, 1/15., 1/7.5 }; - (void) pulse { self.transform = CGAffineTransformMakeScale(0.6, 0.6); [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:pulsesteps[0]]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(pulseGrowAnimationDidStop:finished:context:)]; self.transform = CGAffineTransformMakeScale(1.1, 1.1); [UIView commitAnimations]; } - (void)pulseGrowAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:pulsesteps[1]]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(pulseShrinkAnimationDidStop:finished:context:)]; self.transform = CGAffineTransformMakeScale(0.9, 0.9); [UIView commitAnimations]; } - (void)pulseShrinkAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:pulsesteps[2]]; self.transform = CGAffineTransformIdentity; [UIView commitAnimations]; } Thanks in advance for any help that you can give me.

    Read the article

  • How can I use this downloaded Class(es) on my Prototype Routine?

    - by O.C.
    I'm a newbie and I'm in need of some help. I'm working on a prototype for an app, but I'm learning at the same time. I want to display a popup image over a given UIView, but I would like it to behave like the UIAlertView or like the Facebook Connect for iPhone modal popup window, in that it has a bouncy, rubbber-band-like animation to it. I was able to find the following class(es) on the net, from someone who was trying to do something similar. He/she put this together, but there was no Demo, no instructions nor a way to contact them. Being that I am so new, I don't have any idea as to how to incorporate this into my code. This is the routine where I need the bouncy image to appear... //======================================================== // // productDetail // - (void) showProductDetail { _productDetailIndex++; if (_productDetailIndex > 7) { return; } else if (_productDetailIndex == 1) { NSString* filename = [NSString stringWithFormat:@"images/ICS_CatalogApp_0%d_ProductDetailPopup.png", _productDetailIndex]; [_productDetail setImageWithName:filename]; _productDetail.transform = CGAffineTransformMakeScale(0.1,0.1); [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; // other animations goes here _productDetail.transform = CGAffineTransformMakeScale(1,1); // other animations goes here [UIView commitAnimations]; } NSString* filename = [NSString stringWithFormat:@"images/ICS_CatalogApp_0%d_ProductDetailPopup.png", _productDetailIndex]; [_productDetail setImageWithName:filename]; _productDetail.x = (self.width - _productDetail.width); _productDetail.y = (self.height - _productDetail.height); } and here is the code I found... float pulsesteps[3] = { 0.2, 1/15., 1/7.5 }; - (void) pulse { self.transform = CGAffineTransformMakeScale(0.6, 0.6); [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:pulsesteps[0]]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(pulseGrowAnimationDidStop:finished:context:)]; self.transform = CGAffineTransformMakeScale(1.1, 1.1); [UIView commitAnimations]; } - (void)pulseGrowAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:pulsesteps[1]]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(pulseShrinkAnimationDidStop:finished:context:)]; self.transform = CGAffineTransformMakeScale(0.9, 0.9); [UIView commitAnimations]; } - (void)pulseShrinkAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:pulsesteps[2]]; self.transform = CGAffineTransformIdentity; [UIView commitAnimations]; } My routine is based on the Prototyping class given by Apple during WWDC 09. It may not be "correct" but it works as is. I just would like to add the animation to this image/screen to really make the concept clear.

    Read the article

  • Implementing touch-based rotation in cocoa touch

    - by ewoo
    I am wondering what is the best way to implement rotation-based dragging movements in my iPhone application. I have a UIView that I wish to rotate around its centre, when the users finger is touch the view and they move it. Think of it like a dial that needs to be adjusted with the finger. The basic question comes down to: 1) Should I remember the initial angle and transform when touchesBegan is called, and then every time touchesMoved is called apply a new transform to the view based on the current position of the finger, e.g., something like: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self]; //current position of touch if (([touch view] == self) && [Utility getDistance:currentPoint toPoint:self.middle] <= ROTATE_RADIUS //middle is centre of view && [Utility getDistance:currentPoint toPoint:self.middle] >= MOVE_RADIUS) { //will be rotation gesture //remember state of view at beginning of touch CGPoint top = CGPointMake(self.middle.x, 0); self.initialTouch = currentPoint; self.initialAngle = angleBetweenLines(self.middle, top, self.middle, currentPoint); self.initialTransform = self.transform; } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self]; //current position of touch if (([touch view] == self) && [Utility getDistance:currentPoint toPoint:self.middle] <= ROTATE_RADIUS && [Utility getDistance:currentPoint toPoint:self.middle] >= MOVE_RADIUS) { //a rotation gesture //rotate tile float newAngle = angleBetweenLines(self.middle, CGPointMake(self.middle.x, 0), self.middle, currentPoint); //touch angle float angleDif = newAngle - self.initialAngle; //work out dif between angle at beginning of touch and now. CGAffineTransform newTransform = CGAffineTransformRotate(self.initialTransform, angleDif); //create new transform self.transform = newTransform; //apply transform. } OR 2) Should I simply remember the last known position/angle, and rotate the view based on the difference in angle between that and now, e.g.,: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self]; //current position of touch if (([touch view] == self) && [Utility getDistance:currentPoint toPoint:self.middle] <= ROTATE_RADIUS && [Utility getDistance:currentPoint toPoint:self.middle] >= MOVE_RADIUS) { //will be rotation gesture //remember state of view at beginning of touch CGPoint top = CGPointMake(self.middle.x, 0); self.lastTouch = currentPoint; self.lastAngle = angleBetweenLines(self.middle, top, self.middle, currentPoint); } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self]; //current position of touch if (([touch view] == self) && [Utility getDistance:currentPoint toPoint:middle] <= ROTATE_RADIUS && [Utility getDistance:currentPoint toPoint:middle] >= MOVE_RADIUS) { //a rotation gesture //rotate tile float newAngle = angleBetweenLines(self.middle, CGPointMake(self.middle.x, 0), self.middle, currentPoint); //touch angle float angleDif = newAngle - self.lastAngle; //work out dif between angle at beginning of touch and now. CGAffineTransform newTransform = CGAffineTransformRotate(self.transform, angleDif); //create new transform self.transform = newTransform; //apply transform. self.lastTouch = currentPoint; self.lastAngle = newAngle; } The second option makes more sense to me, but it is not giving very pleasing results (jaggy updates and non-smooth rotations). Which way is best (if any), in terms of performance? Cheers!

    Read the article

  • Stall in animation

    - by tech74
    Hi , I am using this code from this site http://ramin.firoozye.com/2009/09/29/semi-modal-transparent-dialogs-on-the-iphone/ to show a modal view and remove it. It displays fine ie drops in from the top but when being removed it stalls just on its way out just for a fraction of second but its noticeable how do i get rid of the stall. The view i am showing is view of a viewcontroller which is a memeber of the parent viewcontroller so i call methods like this to display [self showModal:self.modalController.view] to hide [self hideModal:self.modalController.view]; (void) showModal:(UIView*) modalView { UIWindow* mainWindow = (((SessionTalkAppDelegate*) [UIApplication sharedApplication].delegate).window); //CGPoint middleCenter = modalView.center; CGPoint middleCenter = CGPointMake(160, 205); CGSize offSize = [UIScreen mainScreen].bounds.size; //CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, offSize.height * 1.5); CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, -100); // start from top modalView.center = offScreenCenter; // we start off-screen [mainWindow addSubview:modalView]; // Show it with a transition effect [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; // animation duration in seconds [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; modalView.center = middleCenter; [UIView commitAnimations]; } // Use this to slide the semi-modal back up. - (void) hideModal:(UIView*) modalView { CGSize offSize = [UIScreen mainScreen].bounds.size; //CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, offSize.height * 1.5); CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, -100); [UIView beginAnimations:nil context:modalView]; [UIView setAnimationDuration:0.3]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(hideModalEnded:finished:context:)]; modalView.center = offScreenCenter; [UIView commitAnimations]; } (void) hideModalEnded:(NSString *)animationID finished:(NSNumber *)finished context:(void )context { UIView modalView = (UIView *)context; [modalView removeFromSuperview]; //[modalView release]; }

    Read the article

  • Calling method on category included from iPhone static library causes NSInvalidArgumentException

    - by Corey Floyd
    I have created a static library to house some of my code like categories. I have a category for UIViews in "UIView-Extensions.h" named Extensions. In this category I have a method called: - (void)fadeOutWithDelay:(CGFloat)delay duration:(CGFloat)duration; Calling this method works fine on the simulator on Debug configuration. However, if try to run the app on the device I get a NSInvalidArgumentException: [UIView fadeOutWithDelay:duration:]: unrecognized selector sent to instance 0x1912b0 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIView fadeOutWithDelay:duration:]: unrecognized selector sent to instance 0x1912b0 It seems for some reason UIView-Extensions.h is not being included in the device builds. What I have checked/tried I did try to include another category for NSString, and had the same issue. Other files, like whole classes and functions work fine. It is an issue that only happens with categories. I did a clean all targets, which did not fix the problem. I checked the static library project, the categories are included in the target's "copy headers" and "compile sources" groups. The static library is included in the main projects "link binary with library" group. Another project I have added the static library to works just fine. I deleted and re-added the static library with no luck -ObjC linker flag is set Any ideas? nm output libFJSCodeDebug.a(UIView-Extensions.o): 000004d4 t -[UIView(Extensions) changeColor:withDelay:duration:] 00000000 t -[UIView(Extensions) fadeInWithDelay:duration:] 000000dc t -[UIView(Extensions) fadeOutWithDelay:duration:] 00000abc t -[UIView(Extensions) firstResponder] 000006b0 t -[UIView(Extensions) hasSubviewOfClass:] 00000870 t -[UIView(Extensions) hasSubviewOfClass:thatContainsPoint:] 000005cc t -[UIView(Extensions) rotate:] 000002d8 t -[UIView(Extensions) shrinkToSize:withDelay:duration:] 000001b8 t -[UIView(Extensions) translateToFrame:delay:duration:] U _CGAffineTransformRotate 000004a8 t _CGPointMake U _CGRectContainsPoint U _NSLog U _OBJC_CLASS_$_UIColor U _OBJC_CLASS_$_UIView U ___CFConstantStringClassReference U ___addsf3vfp U ___divdf3vfp U ___divsf3vfp U ___extendsfdf2vfp U ___muldf3vfp U ___truncdfsf2vfp U _objc_enumerationMutation U _objc_msgSend U _objc_msgSend_stret U dyld_stub_binding_helper

    Read the article

  • UIView Disappears after pan gesture

    - by JulianF
    I am using the following handler for a IUPanGesture. However when the pan ends, the UIView that it is moving disappears. Do I need to add anything else to this code? - (void)pan:(UIPanGestureRecognizer *)gesture { if ((gesture.state == UIGestureRecognizerStateChanged) || (gesture.state == UIGestureRecognizerStateEnded)) { CGPoint location = [gesture locationInView:[self superview]]; [self setCenter:location]; } }

    Read the article

  • Pre-drawing a UIView

    - by LK
    There is information that is only available after drawRect that I need to access when loading a UIView. Is there any way to do a "pre-draw" or offscreen in order to get this information earlier?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >