Skip to content

Instantly share code, notes, and snippets.

View MohamedElzohirey's full-sized avatar

Mohamed Elzohirey MohamedElzohirey

  • Germany
View GitHub Profile
@paztek
paztek / AppDelegate.m
Last active June 11, 2019 20:54
Allows videos to rotate in landscape when displayed in a portrait only iOS app
#import "AppDelegate.h"
#import <MediaPlayer/MediaPlayer.h>
@implementation AppDelegate
{
BOOL _isFullScreen;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
@fuxingloh
fuxingloh / UICollectionView.swift
Last active February 23, 2023 08:38
iOS Swift: How to count the width of the UILabel. And how to size UICollectionViewCell dynamically with label.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let text = collections[indexPath.row].name
let width = UILabel.textWidth(font: titleFont, text: text)
return CGSize(width: width + left + right, height: height)
}
@atomicbird
atomicbird / NSPersistentContainer+extension.swift
Created May 22, 2020 21:39
Back up and restore Core Data persistent stores
//
// NSPersistentContainer+extension.swift
// CDMoveDemo
//
// Created by Tom Harrington on 5/12/20.
// Copyright © 2020 Atomic Bird LLC. All rights reserved.
//
import Foundation
import CoreData