Skip to content

Instantly share code, notes, and snippets.

View DisappearPing's full-sized avatar

Disappear Ping DisappearPing

  • Taoyuan,Taiwan R.O.C
View GitHub Profile
@susanstevens
susanstevens / iphone-popover.md
Last active September 8, 2023 02:25
How to Create a Popover on iPhone

How to Create a Popover on iPhone

Storyboard set up

Add your view controllers in storyboard. In the Size Inspector, change the simulated size of the popover view controller to "Freeform". This doesn't change the popover's size when you run the app, but it does make it easier to lay out subviews correctly.

storyboard

When adding the segue between view controllers, select "Present as Popover".

@PoomSmart
PoomSmart / ContainsEmoji.m
Last active April 7, 2023 02:08
Detect if string contains emoji (Using Objective-C and Swift)
#import <UIKit/UIKit.h>
#import <CoreFoundation/CoreFoundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <CoreText/CoreText.h>
@interface EmojiUtilities : NSObject
+ (CFMutableCharacterSetRef)emojiCharacterSet;
+ (BOOL)containsEmoji:(NSString *)emoji;
@end
@stakes
stakes / uiview-extensions.swift
Last active July 2, 2024 14:55
UIImage from UIView extension
import UIKit
extension UIView {
func createImage() -> UIImage {
let rect: CGRect = self.frame
UIGraphicsBeginImageContext(rect.size)
let context: CGContextRef = UIGraphicsGetCurrentContext()