Please say about size inferred [closed] - swift

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am fresher in Swift language. If I take the size of inferred instead of any other, it will effect in constraints? In which size I should do designing is there any proper method for constraints.

Inferred size means that the Storyboard infers the scene size according to its super-scene size (the parent's size).
If you have a scene that is the size of an iPad and then you add a new scene to your storyboard and create a segue to it, it will automatically resize to the same size as the iPad scene (where the segue originates from).
Freeform ignores the above rule and you're able to size the scene as you like, in the utility pane on the right.
This setting does not affect constraints, and how the view is displayed on actual devices. For that, you need to use AutoLayout and constraints.

Related

Shadows appear inside uiimageview [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am designing the asets to the app in Sketch. I want to use Shadows, and quite a lot of spread. However, the problem is that when I am exporting the assets into my iOS project in Xcode the image view needs to be a lot larger in order for the shadows to exsists.
The problem is that I'm working with a collection view and that means that there is a huge spacing in-between the cells.
Any idea how this could be solved?
You can take your image without shadow and apply shadow using code. you can add shadow to UIIamgeView.
<imageview>.layer.shadowColor = UIColor.tabGrayColor.cgColor
<imageview>.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
<imageview>.layer.shadowRadius = 5
<imageview>.layer.shadowOpacity = 0.7
<imageview>.layer.masksToBounds = false
You can play around shadowRadius to get desired spread.

My storyboard is not edge to edge with the screen [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I'm adding an image but it won't go fullscreen with the iPhone XR, it has white space around it
I tried zooming it in and out for refreshing it, but still won't go fullscreen
I expect the image to go fullscreen
It sounds like you've aligned your image to the Safe Area guide rather than the view edge.
Safe Area guides are inset a bit on iPhone X/XR devices to allow space for the home indicator or the sensor housing (notch). If you want your view to fill the superview, make sure your layout constraints are attached to the superview edge rather than the Safe Area edge.
To fix this, edit your existing constraint from the storyboard, changing the item from Safe Area to Superview:

Is it better to use or to extend a class? (swift) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want a Panel that contains colors to be a UIVisualEffectView. So, blur background and buttons. Like this:
Should I create a ColorPanelView class that extends UIVisualEffectView (or UIView?) or a ColorPanel class that uses a UIVisualEffectView?
What are the differences and which way is better?
If I understand correctly, you're asking if you should make a custom view that subclasses UIVisualEffectView or if you should just add a UIVisualEffectView to an existing view.
If my understanding is correct, then the answer depends on if you need to reuse this view anywhere else in your code. By making a custom subclass of UIVisualEffectView that has your panels on it, you can easily reuse it without repeating much code.
If you know you'll only need it once, you can just add a UIVisualEffectView to an existing view and then customize it the way you want it.
Either will work.
In this case I would just extend UIView instead of UIVisualEffectView. The reason being is that if the design changes and you want the color panel to be on a solid background instead of a blurred background, you can make that change without changing the class you're extending from.

Generate a grid in Swift using Sprite Kit [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have an app idea so mocked it up in C# because that's my most fluent language. I now want to port this over to Swift if possible, how hard will it be to generate a grid of 6x6 blocks, each block needs to be separate from each other as I need to change they're properties and detect touches on them. This is the grid I've currently got running on Windows.
Thanks for any help.
There are a lot of different ways to approach this problem, so you need to provide more details. You could do it with a single custom UIView, drawing the current representation of your model in the drawRect method and it would also be able to handle all of the touch events since you can just calculate where the user did the touch in the same way that you calculated drawing the grid and coloring the squares.
But if you want to use SpriteKit, then this tutorial will show you all the details of doing a 2D array, using sprites, tiles, etc.
http://www.raywenderlich.com/75270/make-game-like-candy-crush-with-swift-tutorial-part-1

iOS 7 dynamically change speech bubble color in messages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Trying to figure out how to incorporate this effect into my app.
It is essentially the adjustment of the colors in the speech bubbles when the user scrolls, as seen in the messages app in iOS 7.
The bubbles close to the top of the screen are light blue, the bubbles towards the bottom are darker.
Create a gradient on your views. Set the start and end color's intensity according to the view's position in the scroll view's superview (using convertRect:toView:). As your scrollview scrolls, update the visible bubbles' background colors according to their current position. An optimization is to only update the views which are visible. Using a table or collection view can help you with that. It's a simple yet effective effect.