2012-07-28 90 views
1

我想從我的應用程序發送一個HTML電子郵件與MFMailComposeViewController,但我遇到了一個問題,有奇怪的填充到右邊。刪除MFMailComposeViewController HTML右邊距?

這裏是我使用的HTML:

</br> 
</br> 
<a href='itms-apps://itunes.apple.com/app/id444395321'> 
<img src='http://brianensorapps.com/whirlworld/wwad.png' height='80' width='320' style='position:relative;left:-10px;margin-right:0px;padding-right:0px;'/> 
</a> 

我不知道哪個正確的CSS標籤是必要的。現在都沒有工作。位置和左標籤用於消除左邊距。

這裏是我試圖避免出現用戶可以滾動過去我的旗幟權情況的圖片: Issue

也有人請我張貼呈現MFMailComposeViewController的代碼:

sharingVC = [[MFMailComposeViewController alloc] init]; 
sharingVC.mailComposeDelegate = self; 
sharingVC.navigationBar.tintColor = [UIColor lightGrayColor]; 
[sharingVC setSubject:@"Check out this app"]; 
[sharingVC setMessageBody:[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sharingEmail.html"] usedEncoding:nil error:nil] isHTML:YES]; 
[self presentViewController:sharingVC animated:YES completion:nil]; 
+0

您可以發佈您完整的代碼? – 2012-07-28 08:43:05

+0

我添加了我的代碼和我承諾的照片,但之前忘記了上傳。 – enbr 2012-07-28 15:56:34

回答

1

要設置左邊距到-10px,這一切舉動向左(給你10px的的右邊緣)

在樣式屬性,改變left: -10pxleft:0px所以你的HTML代碼如下所示:

</br> 
</br> 
<a href='itms-apps://itunes.apple.com/app/id444395321'> 
<img src='http://brianensorapps.com/whirlworld/wwad.png' height='80' width='320' style='position:relative;left:0;margin-right:0px;padding-right:0px;'/> 
</a> 

我想你真正需要的不過是設置位置絕對和左爲0,像這樣:

</br> 
</br> 
<a href='itms-apps://itunes.apple.com/app/id444395321'> 
<img src='http://brianensorapps.com/whirlworld/wwad.png' height='80' width='320' style='position:absolute; left:0px' /> 
</a> 

在我的測試中,它顯示的圖像從屏幕左側一直到右側,沒有水平滾動。

+0

像魅力一樣工作,感謝您的幫助! – enbr 2012-08-06 21:54:50

0

要刪除任何和所有邊距,您可能會考慮包含一個內嵌標籤,用於更改html的輸出。

這可能做的伎倆:

<style type="text/css"> 
body {padding:0px;margin:0px;} 
</style> 
</br> 
</br> 
<a href='itms-apps://itunes.apple.com/app/id444395321'> 
<img src='http://brianensorapps.com/whirlworld/wwad.png' height='80' width='320' style='position:relative;left:-10px;margin-right:0px;padding-right:0px;'/> 
</a>