Search Results

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

Page 2/45 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Issit possible to load a UIVIewcontroller from uiview of another UIViewController

    - by chako89
    Guys, need your advise here. I have: an UIViewController A UIView B: I added subview which is a UIView to the UIViewController A an UIViewController C What I did is: in UIViewController A's viewDidLoad's method, I call this: UIView *subviewB = [[Subview alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)]; [subviewB subviewBMethod]; // [self.view addSubview:rsubviewB]; SubviewBMethod code is to create an view, inside this view have a button. Once this button is clicked, it will change to UIViewController C. I tried this: [self presentModalViewController:self.UIViewControllerC animated:YES]; And I got this error message: warning: incompatible Objective-C types 'struct UIViewControllerC *', expected 'struct UIViewController *' when passing argument 1 of 'presentModalViewController:animated:' from distinct Objective-C type When I run the app, it terminates immediately when I click the button, I opened the console bug, there is no any error message. My method must be wrong, thus my question is: Issit possible to load a UIVIewcontroller from uiview of another UIViewController? If: Yes: How to do it? No: What should I do? THank you =)

    Read the article

  • UIView Animation animates position but not width

    - by Aaron Vegh
    Hi there, I'm trying to transform a UISearchBar, like in Mobile Safari: touch in the search field and it grows while the location field shrinks. My current animation to alter the width and position of the search field only animates the position: just before it slides to the right place, it simply snaps out to the right width. Here's my code: [UIView beginAnimations:@"searchGrowUp" context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationDelegate:self]; CGFloat findFieldWidth = findField.frame.size.width; CGFloat urlFieldWidth = urlField.frame.size.width; CGRect findFieldFrame = findField.frame; CGRect urlFieldFrame = urlField.frame; findFieldFrame.origin.x = findFieldFrame.origin.x - 150.0f; findFieldFrame.size.width = findFieldWidth + 150.0f; urlFieldFrame.size.width = urlFieldWidth - 150.0f; urlField.frame = urlFieldFrame; findField.frame = findFieldFrame; [UIView commitAnimations]; I've modified this code slightly for the sake of presenting it here, but I hope this gives the gist. Any guesses as to why this is happening would be appreciated! Cheers, Aaron.

    Read the article

  • Darkening a UIView

    - by igul222
    I'd like to "darken" a UIView by a certain amount. Right now, I'm doing the darkening like this: UIView *overlay = [[UIView alloc] initWithFrame:mainView.bounds]; overlay.backgroundColor = [UIColor blackColor]; overlay.alpha = 0.5f; [mainView addSubview:overlay]; Unfortunately, this also adds a semi-transparent black overlay to parts of mainView that are transparent. Is there any way to only darken the non-transparent sections?

    Read the article

  • iPhone sdk Cocoa Touch - Pass touches down from parent UIView to child UIScrollview

    - by Joe
    I have a UIView inside my xib in IB and inside that is a UIScrollview that is a small 80x80 square and dynamically loaded with 8 or so 80 x 80 thumbnail images. The UIScrollview is not clipping the images so that they extend out either side so you can swipe left and right to scroll a chosen image into the the centre, paging is on so they snap ti each image. I have researched and found this is the best and possibly only way to do this. The UIScrollview sits in a 'container' UIView for one reason, it is there to receive the touches/swipes and pass them down to it's child the UIScrollview as otherwise all touches would have to start in the small 80x80 UIScrollview area and I wan them to be anywhere along the row of images. I have seen some sample code somewhere for doing this but just can not implement it. Treat me as a noob, starting from beginning to end, how should the UIView and UIScrollview be set up in IB to allow any touches to be passed, and what code should I put into where? The UIView is set up as scroll_container and the child UIScrollview is char_scroll At the moment I have got it all working except for the touches being passed from the parent to the child, and at the moment the touches have to always start inside the UIScrollview (tiny 80x80 box in centre) when I want to be able to swipe left or right in the long 480X80 horizontal parent UIView and have this still scroll the child UIScrollview. Hope you can help and understand what I mean!

    Read the article

  • Animate multiple UIView in a cicle

    - by Giovanni
    Hi all, i'm creating a card game on iphone. My problem is that i want to animate the cards at the beginning of the game making the cards animate from a point to another point in a deck. I move my cards that are UIView, in afor cicle. this is what i do With this code, alla tha cards move together, i need to move the cards separately one after another CGPoint point; // Create the deck of playing cards for (int i = 0; i < 28; i++) { CardView *aCardView = [self.mazzo objectAtIndex:i]; point.x = -100; point.y = 200; aCardView.center = point; aCardView.zPosition = i; [self.viewGioco addSubview:aCardView]; [aCardView release]; //Here i call the method to position the card [aCardView positionCard]; } in the card view there are this methods -(void)positionCard{ [self performSelector:@selector(_positionCard) withObject:nil afterDelay:0.0]; } -(void)_positionCard{ [UIView beginAnimations:@"posizionacarta" context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; [UIView setAnimationDuration:0.3f]; CGPoint point; point.x = 280 + ((arc4random() % 2) - 1); point.y = 240 + ((arc4random() % 2) - 1); self.center = point; [UIView commitAnimations]; [self setNeedsLayout]; }

    Read the article

  • UIView surface Detection

    - by Sanjay Darshil
    In my code I crated two UIView View1 and View2 out of which View2 rotates on finger touch using CGAffineTransform and View1 is drawn like Arrow shaped (triangle) using CGContext. The View1 is steady view (fixed) which Points (shown directed Up) to the Surface of View2 , So I want to detect the View2 surface points when it stopped rotation and appears in front of the view1. How can I made this possible to detect the UIView Surface when it appears in front of another UIView?

    Read the article

  • Hide uiview, but not it's subview?

    - by Malene
    Hi! I have an app where i add ViewB as a subview to ViewA... But the background of ViewB is clearColor, which means that I can see ViewA through ViewB! If I set viewA to be hidden, ViewB goes away too! I am making a "flip-transition" between the views, so I can't just remove ViewA and then add ViewB :-/ -Anybody got an idea about what I can do? Here's my code: [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:mainTableView cache:YES]; [mainTableView addSubview:subTableView]; [UIView commitAnimations];

    Read the article

  • Odd background image resizing on animating UIView

    - by Woody
    I have a UIView in the middle of a view that I am using as a game playing area (in a 2d cocoa view). This image has a background image of the same size as the view. Resizing the view I use animation to make it look smooth (and that works fine). However, when the animation starts, the background image immediately changes size, tiling or being clipped to a size that when the animation finishes, the background image is physically the same size. I don't want this, I want the image to always fit the view, regardless of the view size. UIImage *bgImage = [UIImage imageNamed:@"head.png"]; ... // resize the image returning another image self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:resizedImage]; [UIView beginAnimations:@"resizeView" context:nil]; [UIView setAnimationDuration:.5]; int localViewSize = ... // work out view sizes self.view.frame = CGRectMake(... ,localViewSize,localViewSize); [UIView commitAnimations]; It looks very odd as it jumps to a different size, then animates to the original size. I am guessing that maybe I would have to make a separate view underneath my main view but is that the only way?

    Read the article

  • iPhone UIView frame animation inconsistent why?

    - by Rick
    I have an app that uses an image loaded in from an UIImagePickerController instance. Once the picker is dismissed so as to reduce the jarring transition from the picker layout to the layout of the next function I initially have the UIImageView for the image fill the whole screen and then when the picker is dismissed the image 'squeezes' up to the top left of the screen. from the initWithFrame... targetPicView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 480.0)]; [targetPicView setContentMode:UIViewContentModeScaleToFill]; this in a function called after dismissing the picker... [UIView beginAnimations:@"squeeze" context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.75]; [targetPicView setFrame:CGRectMake(20.0, 20.0, 130.0, 150.0)]; [UIView commitAnimations]; The weird thing is that this works great when the image has been chosen from the library, the view shrinks down with the top left corner in place just as I planned but... If the image comes from the camera then the view shrinks with the top right corner in place instead and appears to come in from the left side of the screen. Can anyone shed any light on this?

    Read the article

  • SIGABRT on any UIView touch

    - by bitcruncher
    Hi. I'm afraid no amount of Googling has been able to save my hyde on this. I seem to be getting SIGABRT error anytime I touch the screen of the phone, on any UIView. The debugger console posts this error before the SIGABRT: .... [310:207] *** -[UIView _exclusiveTouchView]: unrecognized selector sent to instance 0x14c0c0 .... [310:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIView _exclusiveTouchView]: unrecognized selector sent to instance 0x14c0c0' (this is not my specific call to _exclusiveTouchView, of course.) I would gladly post some code, but the truth is I cannot find (or guess) where this problem may be coming from. This is not happening on any ONE UIView but on all the UIViews in my stack. I can summarize the display logic, though, perhaps that will shed some light. So the application is created and a UIWindow is alloc'd. A single viewcontroller is then alloc'd, which makes and adds its own blank self.view, to which the other UIViews, representing the different game states, are attached. Interestingly enough, this error is does NOT happen on the Simulator, but happens consistently on the device. And I should also mention that the application has yet to override/use any of the touchesBegan:/Ended:/Moved: etc... In other words, this error happens without these methods in the code. I'm really not understanding where this error is coming from... Any suggestions?

    Read the article

  • UIView Animation Inconsistent Result

    - by Josh Kahane
    I am trying to make use of UIView animation to slide my views across the screen. I have a UIScrollView in my view controller, in which I have my UIViews. I alos have this method: -(void)translateView:(UIView *)view toRect:(CGRect)rect withDuration:(CGFloat)duration { [UIView animateWithDuration:duration animations:^ { view.frame = rect; } completion:^(BOOL finished) { //Finished }]; } I call this to move my UIView in an animated fashion to a CGRect of my choice over a certain time. I have a loop which creates and slides out 7 views. This works great, I call it like below, the loop of course calling this 7 times on different views: [self translateView:cell toRect:translationRect withDuration:0.7]; However, I can't then call this again immediately afterwards, just nothing happens. Although, lets say I call this again after a 2 second NSTimer, the animation does run, but then when i scroll my UIScrollView, the view I just animated jumps back to its previous CGRect. Hope you can help, its all feeling very un-explanetory, Ill post more code if it isn't making any sense, thanks.

    Read the article

  • Behavior difference between UIView.subviews and [NSView subviews]

    - by zpasternack
    I have a piece of code in an iPhone app, which removes all subviews from a UIView subclass. It looks like this: NSArray* subViews = self.subviews; for( UIView *aView in subViews ) { [aView removeFromSuperview]; } This works fine. In fact, I never really gave it much thought until I tried nearly the same thing in a Mac OS X app (from an NSView subclass): NSArray* subViews = [self subviews]; for( NSView *aView in subViews ) { [aView removeFromSuperview]; } That totally doesn’t work. Specifically, at runtime, I get this: *** Collection <NSCFArray: 0x1005208a0> was mutated while being enumerated. I ended up doing it like so: NSArray* subViews = [[self subviews] copy]; for( NSView *aView in subViews ) { [aView removeFromSuperview]; } [subViews release]; That's fine. What’s bugging me, though, is why does it work on the iPhone? subviews is a copy property: @property(nonatomic,readonly,copy) NSArray *subviews; My first thought was, maybe @synthesize’d getters return a copy when the copy attribute is specified. The doc is clear on the semantics of copy for setters, but doesn’t appear to say either way for getters (or at least, it’s not apparent to me). And actually, doing a few tests of my own, this clearly does not seem to be the case. Which is good, I think returning a copy would be problematic, for a few reasons. So the question is: how does the above code work on the iPhone? NSView is clearly returning a pointer to the actual array of subviews, and perhaps UIView isn’t. Perhaps it’s simply an implementation detail of UIView, and I shouldn’t get worked up about it. Can anyone offer any insight?

    Read the article

  • call method in a subclass of UIView

    - by rdesign
    Hey, I've got a UIViewController and an own class, a subclass of UIView. In my ViewController I make a instance of the uiview. If I tap the uiview a function gets called within it and an overlay appears. TO get rid of that overlay later the user has to tap somewhere on the screen(besides the instance of my class) How do I tell my class to dismiss the overlay? I already thought of delegate. So my thoughts were to make a MyUIViewControllerdelegate. If my viewcontroller receives a tap the delegate should be called. THe only problem is how do I tell my subclass that it should receive that delegate? I Have no instance of my viewcontroller in my subclass so I can not set the delegate. Any Ideas? Hope my problem is clear :) Thanks a lot

    Read the article

  • Zooming to UIView and it's sub-views

    - by leon
    Hi, I have a UIView which I can zoom to (as it is set as a subview of UIScrollView). UIView has UILabel, UITextField, etc. If I just zoom to the UIView, then of course label and text field get fuzzy (the same effect if you are zooming to the image file without changing image resolution). To solve the problem I need to increase the font size and sizes of the UILable and UITextField in according to the scale used to zoom in (scale is passed as a param by the UIScrollView). This is where I am getting confused. Changing frame (by increasing it width and height by zooming scale) I get all my elements (sub-views) repositions (because changing frame effects center and bounds) Question: 1. What would I need to do to zoom in to the sub-views and just increase the sub-view sizes while keeping them in the exactly the same position? thanks

    Read the article

  • How to add UIview over a ViewController and its NavigationController

    - by Roxee Man
    I have a ViewController with a NavigationController and I want to add a translucent UIView with some Buttons over the ViewController when I press a ViewController button, the problem is that I can not put the UIView over the NavigationBar. How can I solve this? This is my code ( Very simple) -(void)setOpacityView { opacityVw = [[UIView alloc] initWithFrame:self.view.bounds]; opacityVw.backgroundColor = [[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.8]; WPCustomButton *closeBtn = [[WPCustomButton alloc] initWithFrame:CGRectMake(230, 10, 80, 20)]; [closeBtn setTitle:@"Close X" forState:UIControlStateNormal]; [closeBtn setBackgroundColor:[UIColor clearColor]]; [closeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [closeBtn addTarget:self action:@selector(closeView) forControlEvents:UIControlEventTouchUpInside]; [opacityVw addSubview:closeBtn]; } // --------------------------------------------------------------------------------------------------------------------- #pragma mark - Button methods -(void) closeView { [opacityVw removeFromSuperview]; } -(void)setProfileImage { [self setOpacityView]; [self.view addSubview:opacityVw]; }

    Read the article

  • Re-ordering a collection of UIView's based on their CGPoint

    - by Chris
    Hi all, I have a NSMutableArray that holds a collection of UIViewControllers Amongst other properties and methods an instance of each of the viewControllers are placed in a parent view The user will place these objects individually when desired to. So essentially I use - (void)addSubview:(UIView *)view when a new view is added to the parent view controller. Because the UI is isometric it's made things a tad more complicated What I am trying to do is re-order the views based on their co-ordinate position, so items higher up the parent UIView frame is indexed lower then views lower in the parent UIview frame. And items that are on the left side of the view are positioned at a higher index to those on the right I think the solution may have to do with re-ordering the NSMutableArray but how can I compare the CGpoints? Do I need to compare the x and y separately?

    Read the article

  • UIView animation does not animate at first try?

    - by Bacalso Vincent
    Considering that my _palette's frame is like this: _palette.frame = CGRectMake(0,480,320,200); I have this code here to slide up/down a UIView: if(![_pallete superview]) { [self.view addSubview:_pallete]; [self.view insertSubview:_tempViewPaletteListener belowSubview:_pallete]; [UIView animateWithDuration:0.3 animations:^{ _pallete.top -= kPaletteHeight; } completion:^(BOOL isFinished) { }]; } else { [UIView animateWithDuration:0.3 animations:^{ _pallete.top += kPaletteHeight; } completion:^(BOOL isFinished) { [_tempViewPaletteListener removeFromSuperview]; [_pallete removeFromSuperview]; }]; } *the _tempViewPaletteListener is just a view with a tap gesture use to dismiss the palette* The problem is when I first try to run code here, the _palette view will just stiffly display right away. What I expected is, it should slide up the _palette view. Though it works fine after the first try

    Read the article

  • How to mask a UIView

    - by Thomas Joos
    hi guys, I'm working on an app where I draw a UIView via code and I fill it with a UIColor. Next thing I want to load a mask.png file (no transparancy, just black and white) and mask the UIView to change its visual appearance. Any idea how to do this?

    Read the article

  • Always center UIView

    - by bresc
    Hi, I have a small UIView that should appear always in the center of the screen. This works great for portrait mode but does not in landscape. To draw the UIView I use: myView.frame = CGRectMake((visibleArea.size.width - MY_VIEW_WIDTH) / 2, (visibleArea.size.height - MY_VIEW_HEIGHT) / 2, MY_VIEW_WIDTH, MY_VIEW_HEIGHT); myView.autoresizingMask = ( UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin ); Any ideas what might be missing?

    Read the article

  • Empty UIView with minimal drawRect: overhead

    - by Benjohn Barnes
    Hi, I have an application that has three nested views that are mechanically important, but have no visual elements: A vanila UIView that doesn't have any content of its own, and is simply used as a host for CALayers. A UIScrollView (that is queried for it's origin and used to position CALayers in 3d: I really only use this view to faithfully replicate the scroll view's "mechanics"), The scroll view's contents: a UIView subclass. It simply picks up touch events and passes them to a delegate - all that is important are its UIResponder machinery. The UIView hosting CALayers is a sibling of a UIImageView that is a background image over which the CALayers are drawn. I'd really like to ensure that none of these empty UIViews have any drawing or compositing overhead (in time, or storage) associated with them, or if that's not possible, to get this overhead as small as possible, and to understand it so that I can perhaps decide if I should try a different approach. In interface builder, I've set all of the views to not clear their context before drawing. I've not set them to be opaque though, because they definitely are not opaque - they are completely transparent. I've found that I need to give the scroll view contents a transparent clear colour (again in IB by setting the background colour's opacity to zero), and this suggests that it is being drawn, which I don't want. So, in short, I've not got much idea of what is and isn't getting drawn (anyone know of a tool like Quartz Debug for iPhone / simulator?), or how to go about stopping things from getting drawn. Advice would be very welcome! Thanks, Benjohn

    Read the article

  • Dynamically changing background color of a UIView

    - by EricM
    Hello- Here's my setup. I have a viewcontroller that I'm creating and adding as a subview. The viewcontroller presents some options that a user can chose from. The viewcontroller is being pushed in response to a "long press" gesture. Within the viewcontroller, I added a child UIView to group some other controls together so I can move them around the screen as a unit and, when they are displayed, center them on the location of the long press. Here is the code that instantiates the view controller, changes its location, and adds it as a subview: UserOptions *opts = [[UserOptions alloc] initWithNibName:@"UserOptions" bundle:nil]; [opts recenterOptions:location]; [self.view addSubview:opts.view]; That bit of code does create and push the viewcontroller, but the call to recenterOptions doesn't do anything. Here is that method: - (void) recenterOptions:(CGPoint)location { CGRect oldFrame = self.optionsView.frame; CGFloat newX = location.x; // + oldFrame.size.width / 2.0; CGFloat newY = location.y; // + oldFrame.size.height / 2.0; CGRect newFrame = CGRectMake(newX, newY, oldFrame.size.width, oldFrame.size.height); self.optionsView.frame = newFrame; } Note that self.optionsView is the child UIView that I added to the viewcontroller's nib. Does anyone know why I'm unable to change the location of the UIView? Regards, Eric

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >