Skip to content

Instantly share code, notes, and snippets.

View patelrohan's full-sized avatar
🤓

Rohan Patel patelrohan

🤓
  • Dynamic Island
View GitHub Profile
@patelrohan
patelrohan / navigationbuttons
Created December 30, 2011 07:18
Add buttons to UInavigationbar
UIToolbar *tools = [[UIToolbar alloc]
initWithFrame:CGRectMake(0.0f, 0.0f, 90.0f, 45.01f)]; // 44.01 shifts it up 1px
tools.clearsContextBeforeDrawing = NO;
tools.clipsToBounds = NO;
tools.barStyle = -1;
NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:2];
// ---------------------------------------Add Pin button----------------------------------.
@patelrohan
patelrohan / loginFacebook
Created February 10, 2012 12:02
Login using facebook account
- (IBAction)loginButtonPressed:(id)sender {
NSString *client_id = @"142759389130183";
//alloc and initalize our FbGraph instance
self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];
//begin the authentication process.....
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:)
andExtendedPermissions:@"read_stream,user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];
@patelrohan
patelrohan / logoutFacebook
Created February 10, 2012 12:03
Logout from application using Facebook a/c
//logout mehthod========================*******************===============
- (void)logOutButtonPressed {
NSLog(@"logout");
fbGraph.accessToken = nil;
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
@patelrohan
patelrohan / Newspot
Created February 18, 2012 08:57
First screen after I capture image from camera.
- (void)viewDidLoad
{
[super viewDidLoad];
btn = 50;
scroll.contentSize = CGSizeMake(320, 570);
app.edit_flag=1;
[btn1 setBackgroundImage:[UIImage imageNamed:@"red_border_box.png"] forState:UIControlStateNormal];
UIBarButtonItem *cancel_btn=[[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelBtnClicked:)];
self.navigationItem.rightBarButtonItem=cancel_btn;
@patelrohan
patelrohan / memory.m
Created February 27, 2012 06:51
Memory Leaks and Bad memory usage
//===================== Memory Leak===========================
NSString *str =[[NSString alloc]initwithFormate:@"Hello"];
UILabel *lbl=[[UILabel alloc]init];
lbl.text= str;
[str release];
UILabel *lbl2=[[UILabel alloc]init];
@patelrohan
patelrohan / Coredata.m
Created March 2, 2012 10:11
Core data
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.title=@"Home";
segmentToggle = segmentedControl.selectedSegmentIndex;
//-------------
if (managedObjectContext == nil)
{
@patelrohan
patelrohan / fetchrequest.m
Created March 2, 2012 12:52
Fetch Request Code
- (void)fetchRecords {
// Define our table/entity to use
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:managedObjectContext];
// Setup the fetch request
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entity];
// Define how we will sort the records
@patelrohan
patelrohan / Crashlog
Created March 6, 2012 12:57
Crashlog
Process: RDRProject [3619]
Path: /Users/c36/Library/Application Support/iPhone Simulator/4.3.2/Applications/82F1880B-5FAA-4F77-A944-3AFA6FCF990D/RDRProject.app/RDRProject
Identifier: RDRProject
Version: ??? (???)
Code Type: X86 (Native)
Parent Process: launchd [92]
Date/Time: 2012-03-06 18:16:44.823 +0530
OS Version: Mac OS X 10.6.7 (10J869)
Report Version: 6
@patelrohan
patelrohan / Scrollsetup.m
Created March 9, 2012 09:08
Scrollsetup
-(void)setUpMiniOnOrientation
{
//RECUPERATION DES PROJETS
if (projectArray != nil)
{
projectArray = nil;
[projectArray release];
}
if (managedObjectContext == nil)
//---------------------------------------Maps Code--------------------------------------
#pragma mark- Maps
-(void)makeAnnotation
{
for (int k=0;k<[annotations count];k++)
{