Number: 009, Date: 2025-03-10

2025.03.03 ~ 2025.03.09

👉 Considerations when UIButton does not receive touch events


If a parent view exists and a button is placed within a child view, there can be various reasons why the button does not receive touch events. In such cases, check the following items in order:

  1. Check if the button is disabled
    • If the button is disabled, it will not receive touch events.
    button.isEnabled = true
    
  2. Check the button’s zIndex
    • If the button is hidden behind another view, it may not receive touch events.
    • Use bringSubviewToFront or adjust layer.zPosition to modify its position.
    // Bring the button to the front
    view.bringSubviewToFront(button)
    
    // Increase the button's zIndex
    button.layer.zPosition = 10
    
  3. Verify the hitTest(_:with:) method
    • The point parameter is provided in the view’s coordinate system, and it returns the frontmost (lowest-level) view.
    • Ensure that an overridden hitTest is functioning correctly.
    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        let view = super.hitTest(point, with: event)
        print(view ?? "nil")
        return view
    }
    
  4. Ensure parent views have Interaction enabled
    • If either the parent view or the button itself has isUserInteractionEnabled = false, touch events will not be delivered.
    button.isUserInteractionEnabled = true
    superview.isUserInteractionEnabled = true
    
  5. Check the touch area
    // Touch events are not delivered if alpha is less than 0.01
    button.alpha = 1.0
    
    // If the parent view has clipsToBounds = true, touches may be clipped
    superview.clipsToBounds = false
    
  6. Check for gesture conflicts
    // If another view's gesture is intercepting touch events
    let gesture = UITapGestureRecognizer(target: self, action: #selector(handleTap))
    gesture.cancelsTouchesInView = false
    view.addGestureRecognizer(gesture)
    
  7. Verify Auto Layout constraints
    • Auto Layout issues may cause the touch area to be different from the intended position.
  8. Check for exclusiveTouch conflicts
    • Touch conflicts may occur with other views.
    button.isExclusiveTouch = true
    

🌈 Variable Font


Variable fonts are an advancement in the OpenType font specification, developed through collaboration among Adobe, Apple, Google, and Microsoft. Instead of using separate files for different widths, weights, and styles, a single file can contain multiple variations of a font.

Variable fonts feature various axes such as width, weight, and slant. These axes can be adjusted numerically to create and combine different styles.

Compared to static fonts, variable fonts allow for greater flexibility in defining styles using just one file.

Font extensions: .otf, .ttf

A simple distinction:

🗺️ Using Fake GPS on iOS


On Android, there are various Fake GPS apps available on the Play Store that allow users to freely modify their device’s location. However, on iOS, there are no such apps available for real devices, aside from simulator settings.

That said, an open-source macOS app called LocationSimulator can be used to modify location settings on iOS devices running versions prior to iOS 17. Since I currently don’t have an iOS 17 or older device, I tested it on a simulator, and it seemed more convenient than manually changing the simulator’s location.

iOS Version Downgrade

iPSW provides a simple way to downgrade to signed iOS versions. However, downgrading via other methods is complex and may cause device issues.

🙋🏻‍♂️ Other Notes


  1. This week, I made simple design updates to the cover image of my development blog and the app style for my side project.
  2. When using the Naver Maps SDK, the logo must not be disabled. According to the NMapsMap iOS Docs, you can adjust the logo position using logAlign and logoMargin, but you should also consider the contentInset property.
  3. While researching GA-related terms, I discovered GTM, a service that allows even non-developers to easily manage event tracking. It seems commonly used for web applications, but I will check if it supports iOS.
  4. In iOS apps, you can use an tag or web view links with a predefined deep link scheme to navigate to a specific screen within the app. If you use OneLink, it redirects externally before navigating to the desired screen.
  5. The App Store featuring function can help promote an app.