UISliderの利用 – iPhoneアプリケーション開発
UISliderをつかってみる。
基本手順
- xcode起動
- 新規プロジェクト作成
- ViewBasedアプリケーション
- 名前入力
InterfaceBuilderファイルグループにある、[プロジェクト名]ViewController.xib(例:UISwitchViewController.xib)をダブルクリック。InterfaceBuilderを起動する。
xcodeに戻って、[プロジェクト名]Controller.h(例:UISliderController.h)を開き、IBOutletとしてUISliderとUILabelクラスのインスタンス変数を定義。また、対応するプロパティも定義し、アクションメソッドを作成。
#import <UIKit/UIKit.h>
@interface UISwitchViewController : UIViewController {
IBOutlet UILabel *uiLabel;
IBOutlet UISlider *uiSlider;
}
@property(nonatomic, retain)UILabel *uiLabel;
@property(nonatomic, retain)UISlider *uiSlider;
-(void)onClick:(id)sender;
@end
続いて、[プロジェクト名]Controller.m(例:UISliderController.m)を開き、プロパティの利用定義(@synthesize)とアクションメソッド実体を定義。さらに、viewDidLoadメソッドで、スライダーの最小値/最大値を設定する。
#import "UISwitchViewController.h"
@implementation UISwitchViewController
@synthesize uiLabel;
@synthesize uiSlider;
-(void)onClick:(id)sender{
NSLog(@"onclick!");
NSLog(@"%f", uiSlider.value);
uiLabel.text = [NSString stringWithFormat:@"%f", uiSlider.value];
}
- (void)viewDidLoad {
uiSlider.minimumValue = 0.0;
uiSlider.maximumValue = 100.0;
uiSlider.value = 50.0; // initial
[super viewDidLoad];
}
InterfaceBuilderを開き、IBOutletと変数、sliderコントロールとアクションメソッドのひも付けを行う

成功。
UISwitchの利用 – iPhoneアプリケーション開発
-
iPhoneらしいUI
- xcode起動
- 新規プロジェクト作成
- ViewBasedアプリケーション
- 名前入力
パーツ、UISwitchをつかってみる。
とりあえず、いつも通りview-basedアプリケーションを作る。
InterfaceBuilderファイルグループにある、[プロジェクト名]ViewController.xib(例:UISwitchViewController.xib)をダブルクリック。InterfaceBuilderを起動する。
View上に、SwitchとRound Rect Buttonを配置する。

xcodeに戻って、[プロジェクト名]Controller.h(例:UIViewController.h)を開き、IBOutletとしてUIButtonとUISwitchインスタンス変数を定義。また、対応するプロパティも定義し、ボタンクリック時のメソッドを作成。
UIViewController.h
#import <UIKit/UIKit.h>
@interface UISwitchViewController : UIViewController {
IBOutlet UIButton *uiButton;
IBOutlet UISwitch *uiSwitch;
}
@property(nonatomic, retain)UIButton *uiButton;
@property(nonatomic, retain)UISwitch *uiSwitch;
-(void)onClick:(id)sender;
@end
続いて、[プロジェクト名]Controller.m(例:UIViewController.m)を開き、プロパティの利用定義(@synthesize)とonClickメソッドを定義。
#import "UISwitchViewController.h"
@implementation UISwitchViewController
@synthesize uiButton;
@synthesize uiSwitch;
-(void)onClick:(id)sender{
if(uiSwitch.on == YES){
NSLog(@"YES!!!");
}else{
NSLog(@"NO!!!");
}
}
InterfaceBuilderを開き、IBOutletと変数、ボタンクリックとメソッドのひも付けを行う

とってもすてき。
PHP – mbstring拡張モジュールのインストール
CentOS5にPHPを標準インストールした環境を提供してもらい、確認してみたらmb_xxx系のメソッドが動かない!で、調べてみたら、mbstring拡張モジュールがはいってなかった。
その対策
yumでインストール
yum -install php-mbstring
あとは、php.iniを編集するだけ。超便利。
rpmでインストール
通常はyumインストールでいいのだけれど、ネットワーク使えない場合とかは、rpmパッケージインストールする。
rpm入手
RPM Search等で、RPMファイル入手。
インストール
サーバにファイルを置いて、以下のコマンド
#rpm -ivh php-mbstring-5.3.3-1.el5.remi.i386.rpm
確認
#ls /etc/php.d curl.ini fileinfo.ini json.ini ldap.ini mbstring.ini ←!!!! phar.ini zip.ini
phpinfo()でも確認
<?php phpinfo() ?>
ナイス!







