發表文章

目前顯示的是有「app」標籤的文章

Caffeine+ Boost Your Productivity

圖片
Most people wouldn't doubt that coffee shop is one of the best places to work, since it seems to have certain magic power to make people being highly productive. But, do we must go into the coffee shop in order to enjoy the cozy atmosphere? The answer now is "NO"!! The app called "Caffeine" could able to give you a portable coffee shop anytime and anywhere you like. You could have all of the coffee shop buzz you want without trying hard to fight for a seat in the real shop, or spend much money to buy latte one after another. "Caffeine", an awsome app which re-create the coffee shop atmosphere for you by serving you many coffee shop buzz easily. You can mix one unique coffee shop buzz along with your own beloved music together to play at a time. Oh, and don't forget to help yourself to make a cup of coffee before you start to stick to this app!! Now, with "Caffeine", who will say that we must go to the real coffee shop to enj...

GPS Wake Me Up

圖片
前陣子聽到有朋友在國外旅行的時候,因為搭車搭過站,導致接下來的行程整個都受到影響,這讓我想到當我們到人生地不熟的地方,加上不熟悉當地的語言,如果沒有注意站點很容易發生這種狀況。或是當下班的時候後累,想說在車上小睡一下,就會發生不小心睡過站的問題。因這幾點讓我想到以前曾經與朋友合作開發過的App,現再重新改裝調整,重新上架。 而這個App審查的過程也是遇到一些狀況,現有用到背景運行的功能,都要加註標語,之前在做的時候都沒有注意到這件。所以讓這個app上架又晚了幾天。不過後來還,只要把文案調整後,就可以了。 以下是介紹。 你是否曾經搭公車或是捷運有過站的經驗嗎?或是當下班後太累不小心睡著,公車又坐錯過站了呢? 這個App就是為您而設計,簡單的設定好目的地後,按下追踨後可以放心好好休息,當快到站的時候,它就會提醒你。 點我下載GPS Wake Me Up 請注意: 1.當使用此應用程式時,務必"開啟鈴聲模式"!!! 2.如長時間在背景模式使用GPS會大量消耗電池可用時間。本程式經啟用後即使於背景中也會保持GPS開啟狀態,不使用時請關閉GPS以節省電力。 3.必須使用具有GPS功能的設備,例如iPhone 3GS、iphone 4、iPhone 4s、iPhone 5、iPad 3G。此應用程式不建議使用在iPod Touch、非3G版的iPad。 4.使用前需同時開啟智慧型行動電話GPS定位服務及3G上網功能,以便app取得您所在的位置。在訊號較差的環境下可能會影響到定位的準確度。

求兩點的距離

CGFloat GetPointDistance (CGPoint p0, CGPoint p1) {     CGFloat xDiff = p0.x - p1.x;     CGFloat yDiff = p0.y - p1.y;          return sqrtf ((xDiff * xDiff) + (yDiff * yDiff)); }

在iphone中如何讓某個uiview順著某個圓心轉

首先定義,把角度轉換成弧度 #define RADIANS( degrees ) ( degrees * M_PI / 180 )  [NSTimer scheduledTimerWithTimeInterval:0.01f                                     target:self                                   selector:@selector(testeeee)                                   userInfo:nil                                    repeats:YES] ; -(void)  testeeee{  if (angle > 360) {         angle = 0;     }              angle++;     //    NSLog(@"%f",angle);     int r = 100;     //    testView.f...

單點讓UIView同時縮放與旋轉

UITouch *touch1 = [sortedTouches objectAtIndex:0]; //觸控移動的點         CGPoint beginPoint1 = *(CGPoint *)CFDictionaryGetValue(touchBeginPoints, touch1);         CGPoint currentPoint1 = [touch1 locationInView:self.superview];         double layerX = self.center.x;//指定UIView的中心點         double layerY = self.center.y;//指定UIView的中心點         double x1 = beginPoint1.x - layerX;         double y1 = beginPoint1.y - layerY;         double x2 = layerX - layerX;         double y2 = layerY - layerY;         double x3 = currentPoint1.x - layerX;         double y3 = currentPoint1.y - layerY;         double x4 = layerX - layerX;         double y4 = layerY - layerY;                  do...

Objective-C的數學運算函式

在寫程式的時候,常常需要用到一些數學運算,這邊整理一下常用的。 pow(x,y) : x 的 y 次方 sqrt(x) : x的平方根 floor(x) : 小於 x 的最大整數 ceil(x) : 大於 x 的最小整數 exp(x) : e 的 x 次方 log(x) : 以 e 為底 x 的對數值 log10(x) : 以10為底 x 的對數值 abs(x) : 整數 x 的絕對值 fabs(x) : 浮點數 x 的絕對值 srand(x), rand() : 產生亂數

如何讓app只能在iphone 4以上運行的方法

設定必要的相容性,一定要有陀螺儀,因這個只有iphone 4以上才有的晶片。 <key> UIRequiredDeviceCapabilities </key> <array>     <string> gyroscope </string> </array> 以下是其他網友被退件後,apple回覆的方法 : Yes, it's possible to make an App only for iPhone 4. However in this case you MUST make use of the UIRequiredDeviceCapabilities to limit the App to some iPhone4-only feature like camera-flash. (My iPhone4 App got rejected because I did not limit it to certain features. I just had added to the description: "Runs only on iPhone 4". The rejection letter told me that I must use the UIRequiredDeviceCapabilities if I want to limit the App to a certain hardware. Resubmitted the App with UIRequiredDeviceCapabilities set and the App got approved right away)

iOS 拍照以及從相簿取出照片

最近在開發camera and album 相關功能的app。將一些用法以及代碼筆記下來。 LCSViewController.h and LCSViewController.m #import @interface LCSViewController:UIViewController @property(nonatomic,retain)IBOutlet UIImageView *imageView; @property(nonatomic,retain)IBOutlet UIBarButtonItem *saveImageBotton; -(IBAction)showCameraAction:(id)sender;//拍照 -(IBAction)saveImageAction:(id)sender;//將照片存到相簿 -(IBAction)pickPhotoFromLibery:(id)sender;//從相簿取出照片 @end #import "LCSViewController.h" @interface LCSViewController () @end @implementation LCSViewController @synthesize imageView; @synthesize saveImageBotton; #pragma mark - Show camera -(IBAction)showCameraAction:(id)sender { UIImagePickerController *imagePickController=[[UIImagePickerController alloc]init]; //You can use isSourceTypeAvailable to check imagePickController.sourceType=UIImagePickerControllerSourceTypeCamera; imagePickController.delegate=self; imagePickController.allowsEditing=YES; imagePickController.showsCamer...

讓你的iOS app可以與你的 Rails server溝通

圖片
今天在fb的社團看到網友分享這個類庫,真的實在太方便了~~ NSRails  is a light-weight Objective-C framework (iOS or OS X) for simple but powerful communication with your Rails server.  The comments above were posted using the demo iOS app bundled with the source.  Download it  and  get started! http://nsrails.com/

iOS 產生隨機亂數1~100

-(IBAction)generateNumber:(id)sender { int number = (arc4random()%100)+1; //Generates Number from 1 to 100. NSString *string = [NSString stringWithFormat:@"%i", number]; label.text = string }

在OpenGL的環境下把畫面存圖片 Code Snippet

在glpaint裡要把畫面存成照片需要加入以下的程式碼。 void ProviderReleaseData ( void *info, const void *data, size_t size ) { free((void*)data); } -(UIImage*) upsideDownImageRepresenation{ int imageWidth = CGRectGetWidth([self bounds]); int imageHeight = CGRectGetHeight([self bounds]); //image buffer for export NSInteger myDataLength = imageWidth* imageHeight * 4; // allocate array and read pixels into it. GLubyte *tempImagebuffer = (GLubyte *) malloc(myDataLength);          glReadPixels(0, 0, imageWidth, imageHeight, GL_RGBA, GL_UNSIGNED_BYTE, tempImagebuffer); // make data provider with data. CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, tempImagebuffer, myDataLength, ProviderReleaseData); // prep the ingredients int bitsPerComponent = 8; int bitsPerPixel = 32; int bytesPerRow = 4 * imageWidth; CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); CGBitmapInf...

Core Data 學習筆記

圖片
做到現終於了解Coredata是怎樣的操作了,之前一直以為會跟ios上的操作不一樣,但是後來 看完了Apple官方文件,發現到Apple其實真得很不錯,從Mac到ios上的用法都大致相同,很 多地方其實可以用ios的一些原理,反推回去,不過還是有些許的部份是不同的。 在Mac上的Coredata,是標榜著" write less code ",這可是這Coredata當時的發展目標,在Mac 上確實真的看到了,他真的要寫的code很少,幾乎是不太要寫到什麼代碼。很快就可以完成 一個資料庫的加入、移除、修改,這三大基本動作,就連關聯式資料庫的一些維護動作,他 也全都在背後全做好了。 到目前的階段大致上需要的功能都有了,接下來可以專心的想如何開發出Mac App了。 以下是基本操作的代碼 在這個測試檔中,使用的Entity Class就叫做"Entity",使用的Model也是叫做Entity,裡面只有 一個欄位就叫做"name",標記為紅色的部份就是需要自已替換上的部份。 - (IBAction)fetchRequest:(id)sender {//取出所有資料          NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];     NSEntityDescription *entity = [NSEntityDescription entityForName:@" Entity " inManagedObjectContext:[self managedObjectContext]];     [fetchRequest setEntity:entity];          NSError *error = nil;     NSArray *fetchedObjects = [ [self managedObjectContext] executeFetchRequest:fetchRequest error:...