Skip to content

Instantly share code, notes, and snippets.

Zafar zafar007

Block or report user

Report or block zafar007

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zafar007
zafar007 / exampleTableView.m
Created Sep 15, 2019 — forked from mteece/exampleTableView.m
Fix for heightForHeaderInSection as it is called before viewForHeaderInSection and the view size until I create it.
View exampleTableView.m
- (CGSize)tableView:(UITableView *)tableView sizeForHeaderLabelInSection:(NSInteger)section
{
NSString *text = [self tableView:tableView titleForHeaderInSection:section];
CGSize constraint = CGSizeMake(self.view.frame.size.width - kSectionTitleLeftMargin - kSectionTitleRightMargin, kMaxSectionTitleHeight);
return [text sizeWithFont:[self fontForSectionHeader] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
View Identifying Subtitles.swift
// Playground - noun: a place where people can play
import UIKit
enum SubtitleType {
case SubRip, SubStationAlpha, LRC, SAMI, YouTube, SubViewer, MicroDVD, WebVTT, TTML, Unknown
func description() -> String {
switch self {
case .SubRip:
View Cookie
@zafar007
zafar007 / ViewController.swift
Created Oct 1, 2016 — forked from kellyegan/ViewController.swift
Send emails with attachments in iOS using Swift
View ViewController.swift
//
// ViewController.swift
// SendEmailWithAttachment
//
// Created by Kelly Egan on 3/17/15.
// Copyright (c) 2015 Kelly Egan. All rights reserved.
//
import UIKit
import MessageUI
@zafar007
zafar007 / gist:2e64da9b5a69094b1971b9edc9ce00d6
Created Sep 9, 2016 — forked from igaiga/gist:1308730
Set UIWebView's user agent into NSMutableURLRequest
View gist:2e64da9b5a69094b1971b9edc9ce00d6
NSString *urlString = [NSString stringWithFormat:@"http://example.com/foo"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
// get User Agent in UIWebView
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSString *userAgent = [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
NSLog(@"UserAgent: %@", userAgent);
[webView release];
[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
NSURLResponse *response;
You can’t perform that action at this time.