Skip to content

Instantly share code, notes, and snippets.

@bensheldon
bensheldon / app_delegate.rb
Last active May 16, 2020 18:09
Creating a flat navigation bar in a RubyMotion iOS iPhone app. (screenshot in the comments)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
# ...
navigation_appearance
#...
end
def navigation_appearance
# Background Color
class MyController < UIViewController
def viewDidLoad
@button = UIButton.alloc.init
@button.when_tapped do
weak_self = WeakRef.new(self) # <--- create a weak reference to self
@alert = UIAlertView.alertViewWithTitle "Alert",
message: "Message",
cancelButtonTitle: "Dismiss",
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'motion-cocoapods'
require 'bundler'
Bundler.require
Dir.glob('lib/tasks/*.rake').each { |r| import r }
VERSION = "1.0.2"
class MyClass
self.instance
Dispatch.once { @instance ||= self.new }
end
end
@frr149
frr149 / transparentModalViewController.m
Created October 20, 2011 18:58
How to create a transparent modal View Controller
#pragma mark - Transparent Modal View
-(void) presentTransparentModalViewController: (UIViewController *) aViewController
animated: (BOOL) isAnimated
withAlpha: (CGFloat) anAlpha{
self.transparentModalViewController = aViewController;
UIView *view = aViewController.view;
view.opaque = NO;
view.alpha = anAlpha;