[Solved] AutoScrolling with zooming image in iphone

– (void)viewDidLoad { [super viewDidLoad]; // 1 UIImage *image = [UIImage imageNamed:@”photo1.png”]; self.imageView = [[UIImageView alloc] initWithImage:image]; self.imageView.frame = (CGRect){.origin=CGPointMake(0.0f, 0.0f), .size=image.size}; [self.scrollView addSubview:self.imageView]; // 2 self.scrollView.contentSize = image.size; } viewDidLoad First, you need to create an image view with the photo1.png image you added to your project and you set the image view frame … Read more

[Solved] add screenshot to email without being saved to library

UIActionSheet *options = [[UIActionSheet alloc] initWithTitle:@”Options” delegate:self cancelButtonTitle:@”Cancel” destructiveButtonTitle:nil otherButtonTitles:@”Email”, nil]; [options showInView:self.view]; #pragma mark ActionSheet Delegate -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { switch (buttonIndex) { case 0: { } default: break; } } #pragma mark Email //Allocating Memory for MailComposer MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init]; mailController.mailComposeDelegate = self; UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); … Read more

[Solved] Is it okay to be learning to program for iOS with an iOS 5 book? [closed]

There are less radical changes to the API, that’s true. Auto-Layout it probably the biggest change. The rest are additions that you can check out later, like Pass Kit, Reminders API, UICollectionView or better social integration. I wouldn’t worry too much about an iOS 5 book being out-dated, if it’s good. Make sure it teaches … Read more

[Solved] Check Null value

You should check for (null) just via if (email == nil) { NSLog(@”null2″); } or just if (!email) { NSLog(@”null1″); } The NSNull class is there to put null values inside collections that normally use null as a terminator symbol. See the apple docs for further details on the NSNull class. 8 solved Check Null … Read more

[Solved] Display picture in gallery [closed]

You could look into UIImagePickerController should only take a short time to implement and easy to get the image the user picks but you cannot change the appearance or extend the functionality. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImagePickerController_Class/ EDIT: Due to my misunderstanding. This GitHub has a very good and easy solution for simply displaying an image in a full … Read more

[Solved] Create a comparison in an array

import Foundation let serverOutput = Data(“”” [ { “language”: “French”, “number”: “12” }, { “language”: “English”, “number”: “10” } ] “””.utf8) struct LangueUsers: Codable { let language: String let number: Int enum CodingKeys: CodingKey { case language case number } init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) language = try container.decode(String.self, … Read more

[Solved] Binary operator ‘

The error is pretty clear. numOfPrecentile is a UILabel?. You can’t compare that to a Double. I would suggest storing your calculation into a Double first before setting numOfPercentile.text. @objc func calculate() { if let yourHeightTxtField = yourHeightTxtField.text, let yourWeightTxtField = yourWeightTxtField.text { if let height = Double(yourHeightTxtField), let weight = Double(yourWeightTxtField) { view.endEditing(true) percentile.isHidden … Read more

[Solved] How to make this HTTP Post request using alamofire? [closed]

let url = “192.168.1.1/api/project” var header = [String:String]() header[“accept”] = “aplication/json” header[“key”] = “David” let reqParam = [“project”:[“title”:”Test Title”,”description”:”Test description for new project”,”priority”:false,”category_id”:1,”location_id”:1]] Alamofire.upload(multipartFormData: { multipartFormData in for (key, value) in reqParam{ do{ let data = try JSONSerialization.data(withJSONObject: value, options: .prettyPrinted) multipartFormData.append(data, withName: key) }catch(let err){ print(err.localizedDescription) } } },usingThreshold:UInt64.init(), to: url, method: .post, headers: … Read more

[Solved] Parse iOS SDK: UIButton segue inside of PFTableViewCell [closed]

You can add a tag to each button that corresponds to its row, ex: button.tag = indexPath.row; Then give that button an action linked to a method which takes the button as a parameter, ex: [button addTarget:self action:@selector(goToCommentView:) forControlEvents:UIControlEventTouchUpInside]; So that when a button is selected, and the method is called, you can get the … Read more

[Solved] Why is XML still used for web service responses, even if JSON is better? [closed]

we cannot say json or xml which is superior each having its advantages and disadvantages.. you can just google the differences. try these links XML and JSON — Advantages and Disadvantages? http://www.quora.com/What-are-the-advantages-of-XML-over-JSON may be your clients are used to xml and they don’t want to change, or they may have experienced some problems using json … Read more

[Solved] How do you add a textview to a image view?

Suppose you’ve already got a UIImage img, then use the following code to add texts -(void)drawText:(NSString *)text onImage:(UIImage *)img { UIFont *font = yourTextViewFont; UIGraphicsBeginImageContext(img.size); [img drawAtPoint:CGPointZero]; CGContextSetRGBFillColor(UIGraphicsGetCurrentContext(), 1.0, 1.0, 1.0, 1); [text drawAtPoint: CGPointMake(20, 20) withFont: font]; UIImage *ret = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return ret; } solved How do you add a textview to a … Read more