#UIScrollView
Explore tagged Tumblr posts
yogeshpatelios · 6 years ago
Video
youtube
Swift 4 & Xcode 11 :- Dynamic UIScrollView in iOS Hindi.
0 notes
youngsterdev-blog · 8 years ago
Video
youtube
How to use ScrollView with AutoLayout in iOS using Xcode8 ?
0 notes
script-ease · 8 years ago
Link
0 notes
advanced-swift · 8 years ago
Link
Very useful when you're working on a view controller who extends behind toolbars or tab bars
0 notes
slimthickkidd · 6 years ago
Text
Resolves Uiscrollview Optimization Problems
Tumblr media
UIScrollView is an incredibly useful
iOS development
control. Unsurprisingly, a large number of articles have been written about how to increase the overall performance of UIScrollView and UITableView. These articles range from recommendations for initializing a descending view to complex loading and preprocessing features of asynchronous content. But even taking into account the period of time this topic has been explored, each new project presents new optimization issues related to UIScrollView and its descendants. Circle frame: UIImage rendering in UIImageView In most modern mobile apps, almost all UITableView cells contain different images (such as a user's avatar, a photo for a post or a video thumbnail). However, the use of high-resolution images creates a bottleneck in scrolling. In addition to the problem of unnecessarily loading a relatively large amount of information on a cellular network, the problem of rendering UIScrollView constantly annoys you. UIImage goes through several independent stages until the user can see the final image on the device screen. These phases include: Decompression of image data Make the data decompressed in CGContext, resize, smooth and perform other similar actions At the same time, decompression and reproduction processes are delayed in this context (lazy) - d. H. They are executed when accessing real data and not during the initialization of UIImage. When this UImage is assigned to the UIImageView image property, all previous layers are executed in the UI thread, causing various delays and jumps in the UIScrollView content while scrolling. Solution 1: Asynchronous image rendering and client-side resizing The first solution is to render asynchronous UIImage in CGContext before adding it to UIImageView. At the same time, it seems quite logical to change the resolution of the image using the actual size of UIImageView and a previously processed and cached image is cached. Solution 2: Resize server-side images With this solution, the size of the content is changed directly on the server so that you can receive an image ready for use on the client side. There are several ways to implement this solution: Creates a source image resource that contains multiple copies of the original image at different resolutions. This action must be performed on the server once the upload is complete. After that, you will need to create a convention between all the platforms that contain the content of the resource, the basic information of the link and a suffix to show the correct resolution Combining the first and second approximations (ie, "flying" the image and caching the new images so that it can be sent without delay if it receives similar requests). Each of these methods has its limits in terms of free space and processing time. Therefore, selection must be made based on the processing power of the server equipment. Interestingly, one of the most flexible, practical and scalable solutions is the use of third-party services described in Solution 3.
4 notes · View notes
ios-goodies · 6 years ago
Text
Week 269
Happy Thursday! There's been a lot of talk in the last years about Swift's ABI stability; many of us wanted Swift to be ABI-stable, thinking Swift's ABI stability is some sort of Holy Grail that would solve all of our problems. This is probably also because many people, myself included 😅, didn't fully understand all the implications of ABI stability. I think the Swift team realised this, because it published two great articles on their blog: ABI Stability and More, by @UINT_MIN and Evolving Swift On Apple Platforms After ABI Stability, by @jckarter, which I totally recommend you read 😄.
Again, we've had a lot of very good articles submitted, and not all of them could fit in the newsletter. You can read all of them on our GitHub.
Articles
Implementing In-App purchases without Keychain and UserDefaults, by @rostyslav_d
Localization in Swift like a Pro, by @Dschee
Hiding third-party dependencies with protocols and extensions, by @mecid
How to TDD in Swift, a step by step guide, by @mokagio
Advanced coordinators in iOS, by @twostraws
Regular Expressions in Swift, by @mattt
Handle disabled mobile data setting, by @thomassenkman
Custom View Controller Presentation Tips & Tricks, by @kylebshr
Tools/Controls
Carbon - A declarative library for building component-based user interfaces in UITableView and UICollectionView, by @ra1028fe5
SegementSlide - Multi-tier UIScrollView nested scrolling solution, by @JiarYoo
Dismissable - Dismissable is super convenient to dismiss with gesture, by @younatics
smoke-aws - AWS services integration for the Smoke Framework , by @Awscloud
Swift for TensorFlow APIs - Deep learning library for Swift for TensorFlow , by @tensorflow
Business/Career
Reflecting on My Failure to Build a Billion-Dollar Company, by @shl
How to take your iOS career to the next level, by @skillsmatter, @twostraws and @purpleyay
Credits
LisaDziuba, mattwyskiel, pmusolino, RenGate, mecid, sochalewski, rbarbosa, thomassenkman, ra1028
1 note · View note
appinessweb · 3 years ago
Text
How to Build a Login Screen in SwiftUI
In WWDC 2019 Apple announced a completely new user interface development framework called SwiftUI. SwiftUI is a user interface toolkit that lets us design apps in a declarative way. There was lots of talk about whether we should use Storyboard or build UI programmatically. SwiftUI is the answer to all these questions. You can now develop the app's UI with a declarative Swift syntax.
No more storyboard, Interface Builder and Auto-layout
Earlier we used to develop user interfaces with storyboards, xib's and auto layout. But with SwiftUI, storyboard and auto-layout are completely out of the picture. Now the code editor is available with a preview canvas.
Migrating from UIKit to SwiftUI
If you've used UIKit before then you need to understand what's the UIKit component equivalent in SwiftUI. Many of the classes you know just by removing prefix UI but few have been renamed. Let's have a look at the list.
1. UIViewController: View
2. UITableViewController: List
3. UITabbarController: TabView
4. UINavigationController: NavigationView
5. UIAlertController: Alert
6. UIAlertController with style .actionSheet: ActionSheet
7. UILabel: Text
8. UITextField: TextField
9. UITextField with secure entry: SecureField
10. UISwitch: Toggle
11. UISlider: Slider
12. UIButton: Button
13. UIStackView with horizontal axis: HStack
14. UIStackView with vertical axis: VStack
15. UIImageView: Image
16. UISegmentedControl: SegmentedControl
17. UIStepper: Stepper
18. UIDatePicker: DatePicker
19. UIPickerView: Picker
20. UITabbar: TabView
21. UINavigationBar: NavigationView
22. UIScrollView: ScrollView
Creating Project:
Step 1 - Creating a new project with SwiftUI
Step 2 - Add the VStack in the View. It will act as Vertical StackView
Step 3 - Add title text as Login in the View and can set style to the Text.
Step 4 - Adding Image to the top of the Screen to show that its user's login and adding frame of width and height as shown below.
Fig 1 - Adding Image and Text
Step 5 - Adding Text Field for Phone Number and password with TestField and SecureField inside the VStack and Alignment to leading.
Step 6 - Adding placeholder to the textfield , Add Text and Value will be saved in the Variable.
Step 7 - Give Divider() for allowing space between two textfield and add style as required for the textfield to be displayed.
Step 8 - Adding padding to bottom and given 15.
Step 9 - Adding Button of forgot password inside the HStack to align the right corner of the screen with the Text as shown below.
Fig 2 - Adding Textfield and SecureField with Forget Password
Step 10 - Add a button with the title “Login” for clicking the login functionality inside the VStack.
Step 11 - In this button Action will be added inside the action closure function and can add text to the button (i.e Title) and Style the button as shown.
Fig 3 - Adding Button with Action and Text
Step 12 - Add a button which will have an action to move to SignUp Screen inside the HStack with spacing. Where the SignUp text will be clickable which we implement using Attribute text Similarly in SwiftUI it is implemented in Simple Way.
Fig 4 - "Don't have an Account ? Sign Up"
Final Result - Login Screen with PhoneNumber and Password using SwiftUI
Conclusion
SwiftUI is new to everyone and might take time to get stable as a framework. But SwiftUI is the future of iOS development. There are a lot of things to learn in SwiftUI.
0 notes
classyfoxdestiny · 4 years ago
Text
ایپل ڈویلپرز کے لیے 120Hz آئی فون 13 پرو الجھن کو دور کرتا ہے۔
ایپل ڈویلپرز کے لیے 120Hz آئی فون 13 پرو الجھن کو دور کرتا ہے۔
ایپل نے تصدیق کی ہے کہ ڈویلپرز حقیقت میں 120Hz استعمال کر سکتے ہیں۔ آئی فون 13۔ پرو اور پرو میکس ، لیکن یہ کہ انہیں فیچر استعمال کرنے کے لیے اپنی ایپس کا انتخاب کرنا ہوگا۔
جمعہ کو ، کچھ ڈویلپرز نے دیکھا کہ تمام ایپس آئی فون 13 پرو کے 120 ہرٹج ریفریش ریٹ سے فائدہ نہیں اٹھا رہی ہیں۔ یہ خصوصیت سکرولنگ یا فل سکرین ٹرانزیشن کے لیے کام کرے گی ، لیکن یہ کہ تھرڈ پارٹی ایپس میں دیگر تمام حرکت پذیری 60Hz پر محدود تھی۔
کیا میں یہ دیکھ کر درست ہوں کہ UIView.animateWithDuration APIs آئی فون 13 پر 120Hz پر بند نہیں ہیں؟ UIScrollView ، سسٹم والے ، اور دھات پر اس کی نظر سے ، باقی ابھی بھی 60Hz ہے؟ pic.twitter.com/t3MeM9cj0E۔
– کرسچن سیلگ (hChristianSelig) 24 ستمبر 2021۔
ایک بہت ہی مشکل کام تھا ، لیکن ایپل نے اب تصدیق کی ہے کہ ایپس درحقیقت اپنی ایپ میں ایک نئی پلسٹ انٹری شامل کرکے اس فیچر سے فائدہ اٹھا سکتی ہیں ، اور یہ اعلان کرتی ہیں کہ یہ زیادہ فریم ریٹ استعمال کرتی ہے۔ جیسا کہ نوٹ کیا گیا ہے۔ میک رومرز۔ ایپل کا کہنا ہے کہ اس کی وضاحت کے لیے دستاویزات جلد جاری کی جائیں گی ، اور یہ کہ اس مرحلے کی ضرورت ہے تاکہ ٹیکنالوجی سے فائدہ اٹھانے والی ایپس ہی اسے استعمال کریں ، اور بیٹری کی زندگی پر پڑنے والے اثرات کو کم کرنے کے لیے اگر تمام ایپس اس فیچر کو استعمال کریں پہلے سے طے شدہ
وی پی این ڈیلز: لائف ٹائم لائسنس $ 16 ، ماہانہ منصوبے $ 1 اور اس سے زیادہ۔
آئی فون 13 پرو میں نیا 120Hz ڈسپلے ایپل کی سب سے بڑی نئی خصوصیات میں سے ایک ہے۔ بہترین آئی فون اس سال ، ہموار سکرولنگ ، دیکھنے اور استعمال کی پیشکش۔ اس میں بیٹری کے تحفظ کے لیے متغیر ریفریش ریٹ اور ایک نیا سپر ریٹنا ایکس ڈی آر ڈسپلے بھی ہے جو پرانے سے کہیں زیادہ روشن ہے۔
ایپل نے مبینہ طور پر تصدیق بھی کی ہے کہ کور اینیمیشن کا استعمال کرتے ہوئے کچھ اینیمیشنز کو متاثر کرنے والا بگ ہے اور آئی او ایس 15۔ راستے میں ہے.
ہم اپنے لنکس کا استعمال کرتے ہوئے خریداری کے لیے کمیشن حاصل کر سکتے ہیں۔ اورجانیے.
(function(d, s, id) var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7"; js.defer = 1; fjs.parentNode.insertBefore(js, fjs); (document, 'script', 'facebook-jssdk'));
var fbAsyncInitOrg = window.fbAsyncInit; window.fbAsyncInit = function() if(typeof(fbAsyncInitOrg)=='function') fbAsyncInitOrg(); FB.init( appId: "291830964262722", xfbml: true, version : 'v2.7' );
FB.Event.subscribe('xfbml.ready', function(msg) // Log all the ready events so we can deal with them later var events = fbroot.data('ready-events'); if( typeof(events) === 'undefined') events = []; events.push(msg); fbroot.data('ready-events',events); );
var fbroot = $('#fb-root').trigger('facebook:init'); ; Source link
0 notes
ktrkathir · 5 years ago
Text
Design UIScrollView using AutoLayout in Storyboard | Xcode 11
Design UIScrollView using AutoLayout in Storyboard | Xcode 11
Hey Everyone,
A Step by step tutorial about How to Design in UIScrollView using AutoLayout Constraints in Storyboard to build the App. 
Dont write a single line of code.
Fully dynamic scrollView content sizes and also allow support for Accessibility features.
Design static design using UIScrollView
View On WordPress
0 notes
jacob-cs · 7 years ago
Link
original source : https://stackoverflow.com/questions/3106961/calculating-height-of-uitabbar
#1 answer
https://stackoverflow.com/a/16621049
If the view controller has an ancestor that is a tab bar controller, you can retrieve the height from that tab bar.
CGFloat tabBarHeight = self.tabBarController.tabBar.frame.size.height;
위와 유사한 방법으로  navigation bar height을 구할수도 있다. 
navigationBarHeight = navigationController?.navigationBar.frame.height
1 note · View note
2bitornot2bit · 4 years ago
Photo
Tumblr media
Create a UIScrollView using Auto Layout in Storyboard for Xcode 9
0 notes
Link
0 notes
toasty323 · 6 years ago
Text
Solutions to Address Uiscrollview Optimization Problems
Tumblr media
Shaded shadows: shadows rendering for UIView Using shadows in the drawing area, you can create a 3D effect that highlights certain elements. This approach is well known and very popular. In most cases, using the default method for adding shadows to objects in the cell will not cause any problems. However, when the cell and the UIScrollView suboviews become overloaded, such an approach reduces the fluidity of scrolling. The problem is that the shadow is calculated using the value of the alpha channel of each pixel of a given UIView, which reduces the rendering of frames per second (FPS). For more information contact with
Mobile App Developer in Austin
. Solution: use shadowPath To avoid these problems, you must use shadowPath when adding the shadow. In this way, you can make the shadow using a specific shape and gradient, which is significantly faster than the pixel-by-pixel calculation process. Views that fail when hiding: rendering shadows for UIView (hidden version) The next performance problem of UIScrollView occurred during the test on the iPhone 6 Plus / 6s Plus / 7 Plus, where the scrolling was reduced. The main animation tool has confirmed a decrease in the refresh rate (FPS) from averages of 55 to 35 on screens with problems displaying the content. When looking for a solution, the team found that the problem was known to these devices and that it was possible to disable transparency in iOS settings. Solution 1: Turn off the shadows The first solution is to disable shadows when UIView is not visible by setting a value of 0 for the shadowOpacity parameter. Although this solution is the simplest and most convenient option if you have a clear visual control system, it is not very versatile. Solution 2: Use shadowPath The second option is to use shadowPath for shadow, which makes rendering much easier. Further requirements can be found in the responsiveness of UIView, animation, and other processes associated with coordinate transformation because it is necessary to support UIBezierPath changes. Content scrolling selection of content: including UIScrollView and UITableView Another task that we encountered and solved during this project was to implement embedded UIScrollView to create a navigation similar to that used in Media, Twitter and IMDb. We had to create a header with general information, a tabbed panel with variable tabs (fixed at the top of the screen while scrolling) and an area with a horizontal UIScrollView containing pages in the form of vertical tables. Solution: use the container The solution to this problem is described in detail in an article by Daniele Margutti entitled "Efficient Scrolling of UIStackView in Swift". The main task of the article is to perform these steps: Implement a delegate of the main UIScrollView function, in particular the scrollViewDidScroll (_ scrollView: UIScrollView) method. Places visible content in views that are containers. Containers must have a FrameSize equal to the size of the content. This allows you to calculate the correct offset size and value of the UIScrollView main view. Calculates the visible portion of the table after each change in the parent UIScrollView offset. Keep the table size of the table less than or equal to the size of the device display. Change frame.origin and contentOffset of the internal UIScrollView to move the visible part and adjust it to the visible part of the parent UIScrollView. Conclusion: the warning is ready Although UIScrollView and UITableView have relatively simple and understandable functional principles, optimization problems are still evident. They can also occur in the case of small deviations in the use of standard component flow.
0 notes
arthurknopper · 5 years ago
Text
Page Control iOS Tutorial
A Page control presents the user with a set of horizontal dots representing pages. The current page is presented as a white dot. The user can go from the current page to the next or to the previous page. In this tutorial some movie posters will be positioned inside a scroll view. When the scroll view is scrolled the page control will update its current page. This tutorial is made with Xcode 11 and built for iOS 13.
Open Xcode and create a new Single View App.
For product name, use IOSPageControlTutorial and then fill out the Organization Name and Organization Identifier with your customary values. Enter Swift as Language and choose Next.
For this tutorial some images are needed, so download the movies posters and drag them to the Assets Library.
Go to the Storyboard and drag a Scroll View from the Object Library to the main view. Next, drag a Page Control from the Object Library below the scroll View. Make sure in the document outline the Page Control is not a child view of the Scroll View. Select the Scroll View and go to the Attributes inspector. In the Scrolling section enable Paging. This will “snap” the images on the screen while scrolling.
The Storyboard should look like this.
Select the Assistant Editor and make sure the ViewController.swift is visible. Ctrl and drag from the Scroll View to the ViewController class and create the following Outlet
Ctrl and drag from the Page Control to the ViewController class and create the following Outlet
Go to the ViewController.swift file and add the following properties
var movies: [String] = ["bad-boys","joker","hollywood"] var frame = CGRect.zero
A movies array contains the filenames of the movies images. The frame is needed for the size of the images.
Next, change the ViewDidLoad(_:) method to
override func viewDidLoad() { super.viewDidLoad() pageControl.numberOfPages = movies.count setupScreens() scrollView.delegate = self }
The numberOfPages property of the Page Control corresponds with the number of dots. Next, add the setupScreens() method
func setupScreens() { for index in 0..<movies.count { // 1. frame.origin.x = scrollView.frame.size.width * CGFloat(index) frame.size = scrollView.frame.size // 2. let imgView = UIImageView(frame: frame) imgView.image = UIImage(named: movies[index]) self.scrollView.addSubview(imgView) } // 3. scrollView.contentSize = CGSize(width: (scrollView.frame.size.width * CGFloat(movies.count)), height: scrollView.frame.size.height) scrollView.delegate = self }
The images will be positioned side-by-side in the frame of the scroll view.
The images are loaded and added to the scroll view.
The contentsize is the total size of the scrollview.
The page control needs to update its current page when the scroll view updates so first the view controller needs to conform to the UIScrollViewDelegate protocol. Change the class declaraion line in
class ViewController: UIViewController, UIScrollViewDelegate {
Add the following delegate method.
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { let pageNumber = scrollView.contentOffset.x / scrollView.frame.size.width pageControl.currentPage = Int(pageNumber) }
The method will be called when the scrolling to the next image is ended. The content offset is the relative position of the the image to the origin of the scroll view. The page number is assigned to the current page.
Build and Run the project. And swipe to scroll to an other movie poster. The current page of the page control will be updated.
The source code of the IOSPageControlTutorial can be downloaded at the ioscreator repository on Github.
0 notes
knowledgewiki · 5 years ago
Text
Why do not working UIRefreshControl in Swift?
I use the refresh function in WKWebview. The function is normal when performing a refresh. But when I load another html file and come back, it is not refreshed.
@IBOutlet var myWebView: WKWebView! var refController:UIRefreshControl = UIRefreshControl() override func viewDidLoad() { super.viewDidLoad() myWebView.uiDelegate = self myWebView.navigationDelegate = self myWebView.scrollView.delegate = self refController.bounds = CGRect.init(x: 0.0, y: 50.0, width: refController.bounds.size.width, height: refController.bounds.size.height) refController.addTarget(self, action: #selector(self.webviewRefresh(refresh:)), for: .valueChanged) myWebView.scrollView.addSubview(refController) ... } @objc func webviewRefresh(refresh:UIRefreshControl){ refController.endRefreshing() myWebView.reload() } extension mainWebViewController: UIScrollViewDelegate{ func scrollViewDidScroll(_ scrollView: UIScrollView) { print("come in ??") if currentHtmlFileName == "Main.html" { scrollView.bounces = (scrollView.contentOffset.y <= 0) } else { scrollView.bounces = false } } }
As you can see from my code, my WKWebview is scrolling, and the function is executed. However, when the function is activated on a different screen and returned, the function is not called, nor is the refresh working.
The steps for reproducing a problem are as follows:
Load the WKwebView page and execute the refresh function.
Scroll to the bottom screen to see if there is a bounce.
If it works normally, go to a different screen. location.href = "./other.html";
Scroll from another screen to the bottom screen to see if there is a bounce.
If there is no bounce normally, please return to the screen. history.back()
And run the refresh function again.
In my case, I have a bounce, but the refresh does not run, and the function is not called.
Has anyone solved the same problem as me? Is this a bug???
1 Answer
I thought a lot about this problem. So my conclusion is history.back() does not change the value of the bounce. Therefore, the bounce value is false.
So I thought I should reinitialize this value. So I added a function in the section that completes page navigation.
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { if currentHtmlFileName == "Main.html" { scrollViewDidScroll(myWebView.scrollView) } }
With this addition, the bounce value was reinitialized, and my refresh worked.
Archive from: https://stackoverflow.com/questions/59028323/why-do-not-working-uirefreshcontrol-in-swift
from https://knowledgewiki.org/why-do-not-working-uirefreshcontrol-in-swift/
0 notes
appinessweb · 4 years ago
Text
How to Build a Login Screen in SwiftUI
What is SwiftUI ?
In WWDC 2019 Apple announced a completely new user interface development framework called SwiftUI. SwiftUI is a user interface toolkit that lets us design apps in a declarative way. There was lots of talk about whether we should use Storyboard or build UI programmatically. SwiftUI is the answer to all these questions. You can now develop the app's UI with a declarative Swift syntax.
No more storyboard, Interface Builder and Auto-layout
Earlier we used to develop user interfaces with storyboards, xib's and auto layout. But with SwiftUI, storyboard and auto-layout are completely out of the picture. Now the code editor is available with a preview canvas.
Migrating from UIKit to SwiftUI
If you've used UIKit before then you need to understand what's the UIKit component equivalent in SwiftUI. Many of the classes you know just by removing prefix UI but few have been renamed. Let's have a look at the list.
1. UIViewController: View
2. UITableViewController: List
3. UITabbarController: TabView
4. UINavigationController: NavigationView
5. UIAlertController: Alert
6. UIAlertController with style .actionSheet: ActionSheet
7. UILabel: Text
8. UITextField: TextField
9. UITextField with secure entry: SecureField
10. UISwitch: Toggle
11. UISlider: Slider
12. UIButton: Button
13. UIStackView with horizontal axis: HStack
14. UIStackView with vertical axis: VStack
15. UIImageView: Image
16. UISegmentedControl: SegmentedControl
17. UIStepper: Stepper
18. UIDatePicker: DatePicker
19. UIPickerView: Picker
20. UITabbar: TabView
21. UINavigationBar: NavigationView
22. UIScrollView: ScrollView
Creating Project:
Step 1 - Creating a new project with SwiftUI
Step 2 - Add the VStack in the View. It will act as Vertical StackView
Step 3 - Add title text as Login in the View and can set style to the Text.
Step 4 - Adding Image to the top of the Screen to show that its user's login and adding frame of width and height as shown below. Read more..
0 notes