[Solved] Image upload in iphone [closed]

first u have to get image form photo library for that use below code. – (IBAction)BrowseImage:(id)sender { if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum]) { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeImage, nil]; imagePicker.allowsEditing = NO; [self presentModalViewController:imagePicker animated:YES]; //newMedia = NO; } } -(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker … Read more

[Solved] sendSynchronousRequest is deprecated in ios 9 [duplicate]

This is a working example, You should use NSURLSession, with Request. func testPost(sender: UIButton) { let session = NSURLSession.sharedSession() let request = NSMutableURLRequest(URL: NSURL(string: “http://localhost:8080/iOSServer/ios/helloworld/swiftCalculator”)!) request.setValue(“application/x-www-form-urlencoded”, forHTTPHeaderField: “Content-Type”) request.HTTPMethod = “POST” let d = “4” let data = “x=4&y=\(d)” request.HTTPBody = data.dataUsingEncoding(NSASCIIStringEncoding) let task = session.dataTaskWithRequest(request, completionHandler: {(data, response, error) in if let error = … Read more

[Solved] How do I capture screen view and share it? [closed]

You can add share button var shareButton: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Action, target: self, action: “shareButtonPressed:”) self.navigationItem.rightBarButtonItem = shareButton and populate share options func shareButtonPressed(sender: AnyObject) { NSLog(“shareButton pressed”) let stringtoshare: String = “This is a string to share” //add current screen shot image to share let imagetoshare = captureScreen() let activityItems: [AnyObject] = [stringtoshare, imagetoshare] … Read more

[Solved] Objective C: split text between brackets

You can solve this problem using a regular expression and NSRegularExpression. Construct a pattern which matches the text between brackets. For example the pattern @”\\[([^]]*)]” matches an opening bracket \\[ – the backslash is required to treat the bracket as a literal character, zero or more characters except a closing bracket [^]]*, groups that text … Read more

[Solved] How to spliit a NSString in iOS [duplicate]

you can do this multiple types assume that this is your String NSString *origialString =@”00:03:45″; Type-1 NSArray *getBalance = [origialString componentsSeparatedByString: @”:”]; origialString = [NSString stringWithFormat:@”%@:%@”, [getBalance objectAtIndex:1], [getBalance objectAtIndex:2]]; Type-2 origialString = [origialString substringFromIndex:3]; Type-3 origialString = [origialString substringWithRange:NSMakeRange(3, [origialString length]-3)]; Type-4 // Use NSDateformatter but not necessary for here solved How to spliit … Read more

[Solved] ios UIView for complete viewController frame [closed]

-(UIView *) returnGradientView { UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = view.bounds; //change your color as you like, I have used black and white gradient.colors = @[(id)[UIColor blackColor].CGColor, (id)[UIColor whiteColor].CGColor]; [view.layer insertSublayer:gradient atIndex:0]; return view; } Edit this will create an gradient view, upper side white … Read more

[Solved] Color Variables in Objective C

What you have defined is a local variable. It is used like this: UIColor *lightGrayHeader = [UIColor colorWithRed:246/255.f green:239/255.f blue:239/255.f alpha:1.0]; self.view.backgroundColor = lightGrayHeader; If you want to use a static method on UIColor to fetch a colour, you could do this: @interface UIColor (MyColours) + (instancetype)lightGrayHeader; @end @implementation UIColor (MyColours) + (instancetype)lightGrayHeader { return … Read more

[Solved] Greek letters in iOS doesn’t work [duplicate]

The problem is that you’re using the Greek mathematical symbols: Those come from the Supplementary Multilingual Plane, and are out of bounds; you have no font that contains them. Instead, use the Greek alphabetic symbols: Using those, I entered the start of the Greek alphabet in a Label in Interface Builder and it works fine: … Read more

[Solved] How to put the burger icon in a UIBarButtonItem?

You’ll want to use the UIBarButtonItem constructor init(image: UIImage?, style: UIBarButtonItemStyle, target: Any?, action: Selector?) an example usage would be: self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: “burger_icon”), style: .plain, target: self, action: #selector(self.someMethod)) In this example “burger_icon” is the name of the image asset in your project and self.someMethod is the method that is called when this … Read more