Post

Replies

Boosts

Views

Activity

UITextView Fonts are blurring after UIScrollView Zoom IN
I have created a small project with UIScrollView, UIView, and UITextView (hierarchy is also the same.) Then I have added UIFont to with size 14 to UITextView. Since I want to enable zoom in/out feature for this, I have added UIScrollViewDelegate to this controller and override viewForZooming method. Then zoom in/out things are working fine except one thing. When I Zoom IN the screen, I can see Fonts which are inside the UITextView is blurred. I want to keep the font quality according to zoom scale after zooming in the finish. So I override scrollViewDidEndZooming and adjust the textView frame size it is not working. After a google search, i found some answers, but I tried them but couldn't find the solution and most of them are very old answers. So I kindly request from you guys, please, help me to resolve this problem and I really appreciate your feedback and help. I have attached my source code for your reference. 		var scrollView: UIScrollView! 		var mainView: UIView! 		var textView: UITextView! 		 		override func viewDidLoad() { 				super.viewDidLoad() 				 				scrollView = UIScrollView(frame: .zero) 				scrollView.translatesAutoresizingMaskIntoConstraints = false 				self.view.addSubview(scrollView) 				NSLayoutConstraint.activate([ 						scrollView.widthAnchor.constraint(equalTo: self.view.widthAnchor), 						scrollView.heightAnchor.constraint(equalTo: self.view.heightAnchor), 				]) 				 				mainView = UIView(frame: .zero) 				mainView.translatesAutoresizingMaskIntoConstraints = false 				mainView.backgroundColor = UIColor.red 				scrollView.addSubview(mainView) 				NSLayoutConstraint.activate([ 						mainView.widthAnchor.constraint(equalToConstant: 600), 						mainView.heightAnchor.constraint(equalToConstant: 400), 						mainView.centerXAnchor.constraint(equalTo: scrollView.centerXAnchor), 						mainView.centerYAnchor.constraint(equalTo: scrollView.centerYAnchor) 				]) 				 				textView = UITextView(frame: .zero) 				textView.translatesAutoresizingMaskIntoConstraints = false 				textView.backgroundColor = UIColor.blue 				textView.font = UIFont(name: "Thonburi", size: 14) 				textView.text = "Hello World" 				textView.textAlignment = .center 				mainView.addSubview(textView) 				NSLayoutConstraint.activate([ 						textView.widthAnchor.constraint(equalToConstant: 200), 						textView.heightAnchor.constraint(equalToConstant: 40), 						textView.centerXAnchor.constraint(equalTo: mainView.centerXAnchor), 						textView.centerYAnchor.constraint(equalTo: mainView.centerYAnchor), 				]) 				 				scrollView.pinchGestureRecognizer?.isEnabled = true 				scrollView.maximumZoomScale = 12.0 				scrollView.minimumZoomScale = 0.2 				scrollView.delegate = self 		} } extension ViewController: UIScrollViewDelegate { 		func viewForZooming(in scrollView: UIScrollView) -> UIView? { 				if let viewForZoom = scrollView.subviews.filter({$0.tag == 1}).first { 						return viewForZoom 				} else { 						return scrollView.subviews.first 				} 		} 		 		func scrollViewDidEndZooming(_ scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) { 				self.textView.frame = CGRect(origin: textView.frame.origin, size: CGSize(width: textView.frame.width*scale, height: textView.frame.height*scale)) 		} }
3
0
1.9k
Jan ’21
Why xcode is not released with OS releases?
I'm an ios developer and I'm using iPhone 12 and it is using for app development and debugging via connecting with xcode. I have enabled auto os update and install on my iPhone and the new ios version 14.6 was installed on the last 25th of May. I'm using Xcode 12.5 version it is not compatible with the 14.6 ios version. Then I checked xcode latest update and 12.5 is the latest and it was released last 26th of April. Finally, I checked xcode beta version in beta releases, i couldn't find any xcode beta releases yet. Today is the 3rd of June and I couldn't use my iPhone for debugging for the last 8 days. So is there any solution for this? highly appreciate your feedback and comments.
2
0
889
Jun ’21