Giter Club home page Giter Club logo

ios-zoominimage's Introduction

ios-ZoomInImage

이미지 줌 인 기능 연습 프로젝트

시뮬레이터라 Zoom 할 때 가운데로만 동작을 하는데, 실제기기로 하게 되면 원하는 위치에서 Zoom 했을 떄 정상적으로 동작한다.

실행 화면

적용 방법

UIScrollView, UIImageView 활용

  1. View 설정

UIScrollView, UIImageView를 사용했고, 기본적인 레이아웃을 잡아주었다.

특이점은, 이미지의 기본 사이즈가 크게 되면 화면에서 일부분만 나온다. 스크롤뷰를 기준으로 오토레이아웃을 잡아서 그만큼 표현이 된 것 같다.

구현하려는 화면이 다르므로, 수정을 했는데, 이미지 넓이, 높이를 상위 뷰(View)를 기준으로 잡아두니 원하는 화면으로 나오게 되었다.

스크린샷 2023-10-26 오전 11 16 53
  1. Zoom In Zoom 기능인 경우 UIScollViewDelegate의 func viewForZooming(in scrollView: UIScrollView) -> UIView?func scrollViewDidScroll(_ scrollView: UIScrollView)를 사용해서 적용했다.
func scrollViewDidScroll(_ scrollView: UIScrollView) {
        if scrollView.zoomScale <= 1.0 {
            scrollView.zoomScale = 1.0
        }
        
        if scrollView.zoomScale >= 2.0 {
            scrollView.zoomScale = 2.0
        }
    }

ios-zoominimage's People

Contributors

bradheo65 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.