Skip to content

Instantly share code, notes, and snippets.

@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@rnapier
rnapier / fix-xcode
Last active October 31, 2024 13:54
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
#!/usr/bin/python
# fix-xcode
# Rob Napier <[email protected]>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active April 20, 2025 10:20
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@icyleaf
icyleaf / umeng_ios_publish_channel_package_tool.sh
Last active October 4, 2015 14:08
iOS 友盟发布渠道自动化脚本
#
# iOS 友盟发布渠道自动化脚本
#
# - 在 Archive 的 "Post-action" 添加脚本去执行 "/bin/sh $SRCROOT/package.sh"
# - 确保在 "Provide build setting from" 选择了当前的 App
# - 在项目根目录($SRCROOT)添加 "iTunesArtwork" 文件(符合 App Store 提交要求的 512x512 px, PNG 格式)
# - 在下面 "" 设置你需要的发布渠道(空格分隔)
# - 在下面设置打包后的 ipa 的输出路径(可选)
# - 执行 "Product > Archive"
#
@Azuritul
Azuritul / Check UIViewController Visibility
Created August 31, 2011 08:54
Check if a view controller is visible
/*
* Check http://stackoverflow.com/questions/2777438/how-to-tell-if-uiviewcontrollers-view-is-visible
* to see the discussions.
* If the container is a UINavigationController,
* we can use the visibleViewController property
* to check the visibility.
*/
navigationController visibleViewController == self
/* Or, we can add a category to UIViewController
@chrisbloom7
chrisbloom7 / BeyondCompare-CrossOver.sh
Created September 29, 2010 18:05
Bash shell script to use Beyond Compare from Versions.app
#!/bin/bash
# This script will open a file compare dialog for files you select in Versions.app. This script requires
# Beyond Compare to be installed into CrossOver for Mac. Note that the BC window doesn't always open
# in the foreground nor does it appear in the Dock, so you will need to CMD-TAB to find it. If you have problems
# using this from Versions try executing the commands below in a normal Terminal window running bash and replace
# the $1 and $2 variables with complete paths to two existing files.
# Setup some variables that CrossOver will need. You should replace these with your own values which can
# be found by opening CrossOver, going to Programs -> Run Command, selecting the bottle you installed
# Uncrustify 0.59
#
# General options
#
# The type of line endings
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input