UIWebView获取当前加载的URL

实现delegate: shouldStartLoadWithRequest

1
2
3
4
5
6
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 
{
	NSURL* url = [request  URL];
	self.urlEdit.text = [url absoluteString];
	return YES;
}

iOS弹出输入框

最简单的弹出输入框的方法是添加一个UITextField到UIAlertView中:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Your title here" message:@"this gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];

CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
[myAlertView setTransform:myTransform];

[myTextField setBackgroundColor:[UIColor whiteColor]];
[myAlertView addSubview:myTextField];
[myAlertView show];
[myAlertView release];

Build Emacs on Mac OS X

emacs.app设置中文字体失败的原因已经找到,默认emacs编译的选项为–cocoa,这里cocoa的字体引擎可能有问题。如果以x的方式自己手动编译emacs (–with-x)的时候,字体的渲染和设置都很正常。(如果大家想尝试x的emacs,可以通过以下方式进行安装)

1
brew install emacs --with-x

这种方式默认emacs被安装在/usr/local/Cellar/emacs/23.3/目录下。但是以x的方式编译出来的emacs,在mac下不是一般的丑- -!!

在Mac OS X下可以通过auto tools编译emacs。

1
brew install emacs --with-x
1
2
./configure -with-jpeg=no --with-png=no --with-gif=no --with-tiff=no --with-ns --with-x=no
make