iphone

Add Border to UISegmentedControl

﹥>﹥吖頭↗ 提交于 2021-01-29 13:43:39
问题 how can i set a border with a color to a UISegmentedControl ? I'm getting this by default (incorrect): I was trying this but nothing happens UISegmentedControl.appearance().layer.borderWidth = 1.0 UISegmentedControl.appearance().layer.cornerRadius = 5.0 UISegmentedControl.appearance().layer.borderColor = UIColor.white.cgColor UISegmentedControl.appearance().layer.masksToBounds = true i want to achieve this border (correct): 回答1: I use this function to alter my SegmentedControl: func

Executing Javascript Code From Objective C

北慕城南 提交于 2021-01-29 13:39:29
问题 I have some javascript code that I need to execute from an objective-c (iPhone) app. The javascript code needs some of the values from the iPhone app. What I mean is, there is a spot in the iPhone app (a textbox ) for a user to type their name. Then the javascript code that runs will be: alert(name) where the name variable is really textbox.text How can I do this from objective-c, without relying on an external webserver? Thank you! 回答1: Add a UIWebView and inject a <script> tag containing

Debugging iPhone Safari from a PC (without an Apple device)

可紊 提交于 2021-01-29 09:11:43
问题 Is it possible to debug iOS Safari without owning an Apple device? I've deployed a React app I've been working on , and later found out the app looked weird when viewed from an iPhone. I live in a country where iPhones are not as popular, and I don't own any Apple device myself. I manually tested the iPhone view using both Firefox's and Chrome's responsive design mode, but couldn't replicate the bug. I've searched for ways to debug iOS Safari from a PC, and(1) found(2) some(3) answers(4), but

Implementing iPhone Location in Objective-C

半世苍凉 提交于 2021-01-29 08:12:15
问题 So ive been trying to learn how to implement iPhone location in Objective-C. Currently I have several files: locator.h #import <Foundation/Foundation.h> #import <CoreLocation/CoreLocation.h> @interface locator : NSObject - (void)locationManager:(CLLocationManager *)manager; @end locator.m #import "locator.h" #import <CoreLocation/CoreLocation.h> @implementation locator - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *

AVAudioEngine no sound

时光总嘲笑我的痴心妄想 提交于 2021-01-29 07:28:54
问题 I have been trying for a while now how to stream real time audio from Data provided from a URLSessionDataTask in iOS. I have declared a custom class for managing the player actions and it looks like this: import UIKit import AVFoundation class AudioDataPlayer: NSObject { //MARK:- Variables //MARK: Constants enum Status{ case playing case notPlaying } let audioPlayerQueue = DispatchQueue(label: "audioPlayerQueue", qos: DispatchQoS.userInteractive) //MARK: Vars private (set) var currentStatus

Fast copy between two FBO(s) or from FBO to Texture in OpenGL-ES 1.1

China☆狼群 提交于 2021-01-29 07:25:57
问题 Greetings. My goal is to implement a pipeline for processing video frames that has a "current" and "previous" frame. It needs to copy a subregion from the "previous" frame into the "current" frame on some occasions. This is a kind of decoder which is part of a larger application. This is what I have running so far, on the iPhone using OpenGL-ES 1.1 glCopyTexSubImage2D .--------------------\ glTexSubImage2D V glDrawArray | image --------------------------> Texture --------------> FBO/Texture -

viewWillAppear not called

我只是一个虾纸丫 提交于 2021-01-29 06:50:50
问题 This is the code that executes when a button is tapped in the view for the viewcontroller that displays the modal dialog: -(IBAction)presentModally:(id)sender { if (self.nvc == nil) { MyModalViewController *vc = [[MyModalViewController alloc] init]; UINavigationController *navvc = [[UINavigationController alloc] initWithRootViewController:vc]; navvc.navigationItem.prompt = @""; navvc.navigationBar.barStyle = UIBarStyleBlack; [vc release]; self.nvc = navvc; [navvc release]; } } [self

Convert string of format “19-07-2018 08:10:24” in date and time both different string format

梦想的初衷 提交于 2021-01-29 06:13:21
问题 I want to Convert string of format "19-07-2018 08:10:24" in date time format. If the date is today then it should be "02:12 am". If the date is of yesterday then it should be like "Yesterday". Otherwise it should be in "DD/MM/yy" format. Currently I am having the time and date in string formate. I want the final answer in string type. If the answer is "DD/MM/YY", then it should be in string format. 回答1: Use the Calendar date functions: func format(date: Date) -> String { let calendar =

how to change gps update time in ios

谁说胖子不能爱 提交于 2021-01-29 06:02:58
问题 I'm looking for a way to get a background location update every n minutes in my iOS application.. now i am getting update in every second.. can i change one second to three or four second or every minute... Here is my code: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { if([self.delegate conformsToProtocol:@protocol(GPSLocationDelegate)]) { // Check if the class assigning itself as the delegate

<Accelerate/Accelerate.h> “file not found”

丶灬走出姿态 提交于 2021-01-29 05:57:27
问题 I want to include linear regression to my iPhone app. After some search, I figured out the LAPACK and BLAS in Accelerate Framework is the right libraries to use. But I have a hard time adding accelerate framework to my XCode. I am using XCode 4.3.2 and MAC OS X 10.7.4 When I add the following line to my XCode: #include it gives me "file not found". If I remove this line, I can not use any functions from LAPACK or BLAS. I have copied and paste the framework from: /system/library/frameworks