Skip to content

Instantly share code, notes, and snippets.

View lamprosg's full-sized avatar

Lampros Giampouras lamprosg

  • Athens, Greece
View GitHub Profile
@lamprosg
lamprosg / BIDViewController.h
Last active December 14, 2015 06:59
(OS) Simple Picker
//So the datasource and delegate will be this view controller.
//So drag and drop the picker outlets in the .xib to the File's Owner (this class)
//Necessary Protocols
//OR drag and drop the datasource and delegate from the connection inspector to the File's Owner
@interface BIDViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>
@property (strong, nonatomic) IBOutlet UIPickerView *picker;
@property (strong, nonatomic) IBOutlet UILabel *resultLabel;
@property (strong, nonatomic) IBOutlet UITextField *dollarText;
@lamprosg
lamprosg / BIDViewController.h
Created February 28, 2013 08:21
(iOS) - Image-Video Picker
//You have to include MediaPlayer and MobileCoreServices frameworks to the project
#import <UIKit/UIKit.h>
//Needed protocols
@interface BIDViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIButton *takePictureButton;
@lamprosg
lamprosg / A-json.js
Created March 3, 2013 12:00
Intro to JSON
//WHAT IT LOOKS LIKE
//Javascript and json objects are written inside "{ }"
var bar = { name: "foo" , city: "SanDiego" };
var data = { sand: true , water:"Clear" , extra: bar }; //bar is the above object
/*******************************************/
@lamprosg
lamprosg / 1.getJSON.mm
Last active December 14, 2015 11:38
(iOS) Parsing JSON - iOS 5+
-(void)parseJSONFromURL:(NSString *)jsonURL {
//Prepare URL request to get the user timeline
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:jsonURL]];
/*******************Sychronous Call Request**************/
//Perform request
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
/********************************************************/
@lamprosg
lamprosg / A-Readme
Last active December 14, 2015 15:18
(iOS) Collection View
Basics:
Cells: cells are the content you wish to display, and inherits their format (bookshelf, circle, line, etc) from a layout that you specify
Supplementary Views: supplementary views are views like labels and section headers/footers
Decoration Views: decoration views are just that – decorations like a bookshelf graphic or a background
---------
@lamprosg
lamprosg / Read me
Last active December 14, 2015 17:59
(iOS) Basic SQLite
USE THIS:
https://github.com/ccgus/fmdb
A Cocoa / Objective-C wrapper around SQLite
---------------------------------------------
OR:
1. Add libsqlite3.dylib to Frameworks
@lamprosg
lamprosg / 1.Theory.mm
Last active May 4, 2022 16:37
(iOS) Touches, taps and Gestures
//Touch events must be implemented in the class for ex. of the control that should handle it. If it doesn't it has to be
//implemented in the parent class (ex. if not in the uicontrol, uibutton,table cell, tableview etc then it will go to UIView.
//If UIView won't handle it, then it will go to the ViewController class. It can end up to the appdelegate class).
//You have to call the parent's function that will implement the event manually
//Four methods are used to notify a responder about touches.
//When the user first touches the screen, the system looks for a responder that has a method called touchesBegan:withEvent:
//Example
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
@lamprosg
lamprosg / INFO.mm
Last active December 14, 2015 21:28
(iOS) Localization
Localization folders have the format
fr_FR.lproj -> ISOLanguage_ISOCountryCode.lproj
Second try, will search: fr.lproj
Third try, will search: fre.lproj
--------------------
String Files:
Named "Localizable.strings" and will be in each localization folder (in the finder - ex. en.lproj fr.lproj)
//In the project thre will be at first 1 file that we'll have to localize for each language and edit each
@lamprosg
lamprosg / 1.SingleThreaded.h
Last active December 15, 2015 01:39
Singleton Class (C++/ Objectve-C)
class Singleton {
public:
static Singleton* getInstance(); //This will get us the singleton class instance
~Singleton();
private:
static Singleton* pInstance; //Flag if the instance already exists or not
//Constructot must be private
@lamprosg
lamprosg / 1.AppDelegate.mm
Last active December 15, 2015 03:39
(iOS) SplitViews and PopOver
//Split Views consist of 2 views (view controllers). A mater view, which usually has a list if options to press)
//and a detailed view which usually displays information based on what the user selected in the master view
//When the iPad is in portrait mode the Split View Controller hides the master panel
//so that the detail panel is able to utilize the entire screen.
//In this case the master view appears as a popover
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];