Questions tagged [uiview]

1

votes
1

answer
203

Views

UIGestureRecognizer created in UIView code not working

I've got a custom subclass of UIStackView that's got some UIImageViews inside it. I want the view to accept a pan gesture to track a slow swipe across its surface. When I configure a UIPanGestureRecognizer in Interface Builder it works, but not in code. Here's an abbreviated version of the class: @I...
Dov
1

votes
1

answer
244

Views

`UIBezierPath.fill()` does not fill inside of `draw()`

I'm cutting a rectangle out of a semi-transparent UIView. When I use UIRectFill() it works as expected. However when I create a UIBezierPath with rounded corners, fill() does not seem to do anything. Oddly, calling stroke() on that same path works fine. WORKS: override func draw(_ rect: CGRect) { s...
rob
1

votes
3

answer
63

Views

Multiple shadows under UIView iOS Swift

I am trying to make a UIButton with rounded corners that has 2 colored shadows. Why is the red (and at this point also the blue 'shadow' layer covering the button? How to get the shadows below the button canvas). I thought it was helping to insert sublayers instead of just adding them. I have made a...
user317706
0

votes
2

answer
12

Views

How can I match Custom View's frame with TableViewCell frame properly?

I have a TableView which contains image stretched into cell and I added a view for darkening the image. Since I want to draw this view only in the beginning and not every time I scroll in table I added my codes into awakeFromNib in TableViewCell. TableViewCell.swift @IBOutlet weak var equipmentImage...
Egrimo
1

votes
3

answer
134

Views

When I add a UIContainerView to a view controller it's type is UIView. How do I get to the viewcontroller for the embedded view?

When I add a UIContainerView to a view controller it's type is UIView. How do I get to the UIViewController for the embedded view? I need to set some properties of the embedded view view controller. Thank you
John Cashew
1

votes
2

answer
83

Views

Parallelogram view using UIBezierPath

I am trying to create custom parallelogram view using UIBezierPath but not getting a perfect one. Following is my custom view code class CustomView: UIView { override func draw(_ rect: CGRect) { let offset = 60.0; let path = UIBezierPath() path.move(to: CGPoint(x: self.frame.origin.x + CGFloat(offs...
azhar
1

votes
1

answer
16

Views

How to distribute 4 components in UITableViewCell with autolayout?

I have a view with an UITableViewCell. In this custom cell like this: I have added the textFields into UIViews, and all uiviews have this constraints with autolayout: but then, when is running on device, all views are distributed with bad forms: The first uiview is deformed How could I add the const...
user3745888
1

votes
1

answer
30

Views

How can I increase performance

my app has a view that basically consists of a complex grid. There are roughly 1400 subviews. On 'modern' devices the transition to this view is fairly smooth - you notice a slight delay if you are looking for it. On 'older devices' such as an iPhone 6 the delay is more noticeable. It takes about a...
Joseph
10

votes
3

answer
4.2k

Views

Observing change in frame of a UIView during animation

I want to observe changes to the x coordinate of my UIView's origin while it is being animated using animateWithDuration:delay:options:animations:completion:. I want to track changes in the x coordinate during this animation at a granular level because I want to make a change in interaction to anoth...
samonderous
1

votes
0

answer
65

Views

Scaling UIView after Rotation causes jump in initial scale

I have a view which I would like to scale and rotate with gesture recognisers. I calculate new bounds for scale like so: let newBounds = moveView.bounds.applying(CGAffineTransform.identity.scaledBy(x: scalee, y: scalee)) And it works fine without rotation getting involved. After simple CGAffineTrans...
HelloimDarius
1

votes
1

answer
104

Views

How to get the contents of a UIView even if it is being rendered with gl or metal

I would like to get the contents of a UIView. The UIView is offscreen and another library is rendering content to the view. I believe the library is actually rendering to an underlying GL or metal surface. When I try renderincontext i only get the UI elements within the view (like sliders, butto...
Pineapple Joe
1

votes
2

answer
126

Views

Custom UIViews For Collage App

I am working on a collage application, and I have successfully build the simple collages but now I am stuck on how to build complex style collages like in the following image How I will be able to create the custom view like in the image, I have tried using Beizerpath and by applying masking to the...
Bilal Mustafa
1

votes
0

answer
208

Views

Magnifying glass UIView

Trying to add a magnifying-glass effect to a uiview, but the magnfifying glass is always black. My code for the Magnifing glass view: public override func draw(_ rect: CGRect) { let context = UIGraphicsGetCurrentContext()! context.translateBy(x: self.frame.size.width/2, y: self.frame.size.height/2)...
user3653164
1

votes
1

answer
280

Views

UIView animation in UITableView doesn't work after reload data

I am facing a strange bug in my app right now. I have an extension for UIView that rotates an indicator 90 degrees to the left and right. I am using an UITableViewController as a navigation drawer. I also added an expandable list and use an UITableViewHeaderFooterView for the main areas (which have...
Brudus
1

votes
1

answer
72

Views

UIView.animate - using .autoreverse with other options

When using UIView.animate with .autoReverse, does it keep other options during the auto reverse? If I have a .curveEaseOut, is that option kept for the reverse, or will it just use the default .curveLinear option?
Ryan Stone
1

votes
2

answer
2.9k

Views

iOS - How to initialize custom UIView with specific Frame from NIB

I am wondering what is the cleanest way to initialize a custom UIView with a specific frame. The UIView is designed from a XIB file. Here is my implementation : class CustomView : UIView { @IBOutlet var outletLabel: UILabel! public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder...
Balanced
1

votes
2

answer
57

Views

Balancing adaptive size fonts (UIFontMetrics) with UIView sizes?

I have integrated UIFontMetrics into my app, this works fine, but in many cases my strings are trimmed with ... where the new size exceeds bounds of the view. Now the issue here is I can't blow my UI up to be massive based around the font size, so how do I handle accommodating when a user picks the...
JJPark
1

votes
0

answer
32

Views

Resizing/Scaling PDF Pages when converting each UIView into NSMutableData

I have this simple function that accepts an array of UIViews which are of the same sizes which basically could accept either large or smaller views. Then the function would be responsible for scaling each UIView into a 612 x 792 dimensions. How could I achieve this with proper view scaling? What I h...
Jojo Narte
1

votes
1

answer
23

Views

Shouldn't this code work UIView class Visibility?

I have a class that is named Dataview that is connected to an ordinary View in my app and now I'm trying to change the visibility of this view with the class name and alpha and it's not working. So my question is why? Here is the code: import UIKit class DataView: UIView { var sliderOne = SliderOne...
1

votes
0

answer
48

Views

UITabBar change view hierarchy after rotating process. (or changes its position in view hierarchy)

I have a view with several subviews (with only one peculiarity I added tabBar as a subview to a view of VC) super.viewDidLoad() view.addSubview((tabBarController?.tabBar)!) view.addSubview(collectionView) view.addSubview(pageControl) view.addSubview(skipButton) view.addSubview(nextButton) print( vie...
Ninja
1

votes
2

answer
128

Views

How to increase a XIB view based on it's contents?

I have a XIB which is of this size: (width: 300, height: 100) while designing. It has 3 labels which will be expanding based on its content. I am simply loading that XIB and adding it to the self.view. Is there a way that I can easily increase the XIB view height as UILabel increases? I have success...
Hemang
1

votes
1

answer
68

Views

IOS View how to make it see-through and completely disapper

I have a TableView and I have a view that is on top of the TableView so as you scroll down on the TableView that view is always displayed . What I now want is that when a user is scrolling up on the TableView I want that overhead view to completely disappear and not be seen at all . Right now when t...
user1949387
1

votes
1

answer
73

Views

Close Button Not Working in Swift Playground

I am working on a Swift playground for WWDC. I need to have a UI Button that closes the web view and toolbars (the button is called closeButton and the function is at the bottom for the button), and returns to the previously screen when clicked (the first view). The code below is the Swift I have ty...
Mark_Bruckert
1

votes
1

answer
60

Views

bounds width are different between iPhone7Plus and iPhone6 version

I've created Custom UIView and added small delimiter (1point height) inside that UIView. Problem is it's perfectly working on iPhone6 and iPhone7. But plus version, it cannot be took 100% of its view width. It needs 40points to fill 100% of its view width. My code is as follow: override func setup()...
PPShein
1

votes
0

answer
498

Views

iOS: adding buttons to Toolbar programmatically

I need to create Toolbar and add buttons programmatically. I will have different sets of buttons for diferent screens. That's easy. Also, I need to center those buttons. They should have equal space between them. And also I need that all those buttons separate screen width only between themselfs....
Marksss
1

votes
2

answer
397

Views

how to access custom view button action in main VC

I have created a custom view xib and give that view class. Now I take a view in main vc and give that class but now I want to access custom view button action method in my main vc. So how can I do that? Here is my custom view import UIKit class TextCustomisationVC: UIView { @IBOutlet var contentVie...
Jitendra Modi
1

votes
2

answer
83

Views

Set alpha value for only a part of an UIImageView

I have put 2 UIImageViews on top of each other. The bottom one is just a green image and the top one is blue. On top of that I have a UIView. The idea is to be able to drag the UIView up and down, and instead of only seeing the green colour, the UIView will show the bottom image, the blue colour, i...
Bijan Negari
1

votes
0

answer
90

Views

How to print Xcode UIview names programatically in Swift 4

In XCode, you can create a view hierarchy. The names of the views are generic -- label, text, slider, view, stack view, etc. In the interface, you can rename these controls to something meaningful. How do you access this name from within the program in Swift 4? I'm trying to debug an issue with...
MACE
1

votes
0

answer
50

Views

iOS Swift3: Programmatically load rotating views or use gif as background image?

Is there a more 'best practices' way to implement a rotating image on launch screen? I'm currently using the SwiftGifOrigin library with a gif to accomplish this, and it's working well. (There's nothing else on the screen other than a tap gesture.) Since gifs aren't natively supported, I feel like w...
Ando
1

votes
2

answer
184

Views

_UIRemoteView - reveal view hierarchy in Xcode

I'd like to see, how the Apple's UI frameworks are composed, in particular, the ContactsUI. However, when I try to Debug View Hierarchy in Xcode, I see only the blank _UIRemoteView. Is there any way to peek inside the view hierarchy of the contact composer view? On the left - how the composer looks...
1

votes
1

answer
63

Views

UIView pan gesture along Y axis

I have a UIView that I can drag and drop along the Y axis that snaps into 1 of 2 positions. The issue is that I have to drag it over a certain point in the Y axis in order for it to snap into place. This feels clunky when you try to quickly swipe but don't make it past that specific Y axis and it sn...
Niall Kiddle
1

votes
1

answer
49

Views

Storyboard initializing UIView instead of my custom class

I have a custom class called NumberView which subclasses UIScrollView. I put a UIView onto my storyboard and changed the class to NumberView: I then created an outlet to my ShotTraceViewController class: @interface ShotTraceViewController () @property (weak, nonatomic) IBOutlet NumberView *numberVi...
Chase Roberts
1

votes
1

answer
96

Views

When animating view with UIView.animate other views are also needlessly animated

I'm wondering why views in my custom TableViewCells are affected by animation which should animate only 2 views in my floating pager (which is even not in TableView's view hierarchy.. UIView.animate(withDuration: 0.3) { self.stateIndicator.isHiddenInStackView = true self.loaderIndicator.isHiddenInSt...
1

votes
2

answer
59

Views

How to present a UIView from bottom to half of the screen in Swift3 iOS?

I want to move my UIView, that I have added to my Storyboard from bottom to half of the screen with some animation. I don't want to present any UIViewController, And also don't want to use any Third party Library. I tried to resolve this by setting frame origin y of UIView but not achieving. Pleas...
user2786
1

votes
4

answer
241

Views

UIView transform.scaleBy animation not working

I was doing some hobbyist programming for iOS in Objective C, but dropped out around the time Apple transitioned to Swift. Very recently started trying to learn Swift, and cobbled together a very simple app just to start understanding it. I have a screen that starts with a UIView, and three buttons,...
rattletrap99
1

votes
1

answer
430

Views

Property observers for UIView bounds and frame react differently

While I am exploring the option to observe a UIView's bounds or frame change (mentioned here and here), I have encountered a very strange discrepancy: didSet and willSet will be triggered differently based on where you put your UIView in the view hierarchy: If I use property observer for UIView at t...
HuaTham
1

votes
0

answer
45

Views

How to tap a view that's underneath another view with voiceover

I have a UICollectionView with a contentInset at the top. In the contentInset area, is the Top View. The top view is physically behind the UICV, with hit testing that passes the touches through to the TopView. ie: Touches in the TopView area pass through the UICV and are recognized by the TopView....
wyu
1

votes
0

answer
32

Views

UIView added to SKScene have strange border

I need to add UIView with white background (have HUD class that is used through out the app) to the SKScene with white background. The code is something like this: class CategoriesGameScene: SKScene { override func didMove(to view: SKView) { let view = UIView(frame: CGRect(x: 0, y: 0, width: scree...
Alexey Demidov
1

votes
0

answer
34

Views

iOS - Why is UIDatePicker a UIControl subclass while UIPickerView is simply a UIView subclass?

Given that both the classes provide quite similar functionality (differing mainly in the kind of data they let the user select). What is the potential architectural design decision while led UIDatePicker to be created as a UIControl subclass while UIPickerView to be created simply as a UIView subcla...
Nimesh Neema
1

votes
0

answer
120

Views

Synchronize CABasicAnimation and UIView.animate to be the same

I'm trying to create an animation where when the user drags a UIView then release it, the UIView return to it's initial position. Problems is, I have CAShapeLayer connected to that UIView that I want to stay connected while the UIView return to it's place. CAShapeLayer uses CABasicAnimation and the...
Jaythaking

View additional questions