subview

iOS - Changing frame of a subview of a subclassed UIView (using storyboard with auto layout enabled)

风流意气都作罢 提交于 2019-12-12 19:22:50
问题 I am building a custom progress bar (subclass of UIView). I add an UIImageView to the UIView that uses repeating images to display the progress. The view is added to the storyboard and I can get it to display just fine, however if I try to change the frame then it only displays whatever is shown in the storyboard file (i.e. if the storyboard view has a yellow background, but the code of the uiview subclass changes it to green, if I try to change the frame of the UIImageView in the code to

viewDidAppear for subviews

早过忘川 提交于 2019-12-12 12:31:00
问题 I want to load some data when a button is pressed and show a "loading view" as a subview of my current view while it's loading. So I want to start loading only after the subview did appear. If not my UI gets stuck without a notice (and the subview only shows after the loading is done). Is there a way to use something like viewDidAppear for subviews? Doing the work right after the addSubview: like this doesn't work: - (void)doSomeWorkAndShowLoadingView { UIView *loadingView = [[[UIView alloc]

Gap between navigation bar and subview ios?

依然范特西╮ 提交于 2019-12-12 09:59:36
问题 I understand there is this question: Adding subview leaves gap between subview and navigation bar However, there is no answer, and I do my method a different way, so that might make it a bit different. Anyways, I as well have a gap between the navigation bar and subview when I add a subview to my navigation controller, which also has a tab bar controller. I am using storyboards. I am adding the subview using UIViewController.view type via storyboard id. My code: [self.view addSubview:[[self

Custom View in UIAlertController

醉酒当歌 提交于 2019-12-12 09:53:17
问题 I am trying to put a custom view inside a UIAlertController . I'm running into some odd issues with the sizing of the custom view. I want the custom view to span the width of the UIAlertController , whatever that might be. I'm using CGRectGetWidth(alertController.view.bounds) to get the width of the alert controller. However, this seems instead to be returning the width of the entire view. using view.frame does not make a difference. UIAlertController *alertController = [UIAlertController

iOS 7.1 removeFromSuperview crash

微笑、不失礼 提交于 2019-12-12 07:30:43
问题 My app didn't have any crash until iOS 7.1 came out. Now on any removeFromSuperview method, crash. For example: I got view controllers, and when I want to remove a view controller, I remove all of its subviews, and then remove from the stack (stack: I'm storing view controllers in this, for load new contents, and load previous contents): for (UIView *subView in [contentVc subviews]) [subView removeFromSuperview]; And I got -[CALayer retain]: message sent to deallocated instance message

ios sub view appears upside down in simulator

允我心安 提交于 2019-12-12 04:08:00
问题 I have created an activity indicator and a label below it in a uiview sub class and calling it in many different tabs.It works as intended in most of the places i'm calling it except in Graph Hosting views(CPTGraphHostinView). In this particular view the subView appears to be upside down.The label goes above the spinner.I tried with imageview instead of label, and its the same upside down image. Here is my initWithframe method - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame

How to add a subclass as a subview so that background of subview is set in front of superview

霸气de小男生 提交于 2019-12-12 01:32:11
问题 I got 2 classes @interface PlayScene : UIView and @interface GameOverMenu : PlayScene <UITextFieldDelegate> in PlayScene I create an instance of GameOverMenu GameOverMenu* gorm = [[GameOverMenu alloc]initWithFrame:CGRectMake(0, 0, 320, 520)]; gorm.backgroundColor = [UIColor blackColor]; [self addSubview:gorm]; But background is set not for subview but for superview, I mean background doesn't hide elements of PlayScene view so that buttons and some drawing remain in front of the background If

NSView subView not visible after added to superView

£可爱£侵袭症+ 提交于 2019-12-12 01:28:08
问题 this is my final window i added 4 subviews (last 4 in 2nd image) to the base view. but not displaying the view. after manual resizing window the subviews appeared as below. how can fix it? 回答1: baseView.needsDisplay = YES; -- or -- subview.superview.needsDisplay = YES; 回答2: You can use NSScrollView: NSScrollView* scrollView = [[NSScrollView alloc] init]; [scrollView setHasHorizontalScroller: YES]; [scrollView setHasVerticalScroller: YES]; self.contentView = [[NSView alloc] initWithFrame:

UIScrollView - Custom Map - Prevent marker subview on map from scaling with map

倖福魔咒の 提交于 2019-12-11 17:55:33
问题 I have a custom map of a limited area, and have it set up to correctly show the users' location. The map is a 1600px square image within a UIScrollView. I have a crosshair image to show the current location of the user, which at zoomScale 1.0 is the desired size. When I pinch and zoom the scrollView, the crosshair scales with it. I would like to have the subview remain the same size on screen. I haven't been able to find any information on this, what would be the best way to go about this? If

Subviews not showing up in UIView class

风流意气都作罢 提交于 2019-12-11 16:12:27
问题 I'm trying to lay out some images in code using addSubview, and they are not showing up. I created a class (myUIView) that subclasses UIView, and then changed the class of the nib file in IB to be myUIView. Then I put in the following code, but am still getting a blank grey screen. - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code [self setupSubviews]; } return self; } - (void)setupSubviews { self.backgroundColor = [UIColor blackColor];