尽管在“属性”检查器中启用了分隔线,但自定义tableView单元格下未显示分隔线

时间:2018-07-23 22:57:28

标签: ios uitableview

所以我去了TableView的属性检查器,并添加了“单行”分隔符,如下所示:

enter image description here

分隔符似乎出现在情节提要tableView中

但是,当我运行该应用程序时: No lines

这是通过Storyboard完成的,因此不确定是否还需要其他信息。 万一我使用xcode源代码控制将其上传到Github:

https://github.com/bigmit2011/TableView-TableView

关于我在做什么错的任何线索吗?

2 个答案:

答案 0 :(得分:1)

您需要正确设置约束

1-对于stackView,将其开头,结尾,顶部,底部传递给容器

2-对于单元格内的图像视图,请使其领先

3-要么实现import smtplib from email.message import EmailMessage from email.message import MIMEPart from email.mime.multipart import MIMEMultipart from base64 import encodebytes import mimetypes mSubject = 'Another new family reunion' mFrom = 'me@mgmail.com' mTo = 'mom@yahoo.com' mCC = 'sis@roadrunner.com' sLogin = 'me@gmail.com' sPass = 'mypass' mServer = "smtp.gmail.com" mPort = 465 filename1 = "file1.jpg" filename2 = "file2.jpg" filename3 = "file3.jpg" image_cid1 = filename1 + "@xxxx1" image_cid2 = filename2 + "@xxxx2" def inline_part(filename, icid): """ Creates a MIMEMultipart for embedded images """ part = MIMEMultipart('related') fp = open(filename, 'rb') part.set_payload(encodebytes(fp.read()).decode()) fp.close() part.add_header('Content-ID', '<' + icid + '>') part.add_header("Content-Transfer-Encoding", "base64") return part def attach_part(filename): """ Creates a MIMEPart for attached images """ part = MIMEPart() fp = open(filename, 'rb') part.set_payload(encodebytes(fp.read()).decode()) fp.close() part.add_header("Content-Type", mimetypes.guess_type(filename2)[0] + '; filename="%s"' % filename) part.add_header("Content-Transfer-Encoding", "base64") part.add_header('Content-Disposition', 'attachment; filename="%s"' % filename) return part #set up the mime types mimetypes.init() # Create the container email message. msg = EmailMessage() msg['Subject'] = mSubject msg['From'] = mFrom msg['To'] = mTo msg['Bcc'] = mCC body ="""<HTML> <head></head> <body> This is a test email to send an attachment. This is a linked image: <div align="center"><p><img src="http://www.freedigitalphotos.net/images/previews/success-road-sign-10031660.jpg"><br></p><p>&nbsp;</p></div> we will try to add two in-line images as well, named file1.jpg and file2.jpg """ # add each of the the in-line photo body info body += ' <p>This is file 1</p>\n<p><img id="'+ filename1 + '" src="cid:' + image_cid1 + '" alt="file01.jpg"></p>\n' body += ' <p>This is file 2</p>\n<p><img id="'+ filename2 + '" src="cid:' + image_cid2 + '" alt="file02.jpg"></p>\n' #add the rest of the body body +=""" <p>and we have attached one file "file3.jpg" </body> </HTML> """ # add the body to the message msg.add_alternative(body, subtype='html') msg.set_boundary("===myBoundry") # attach the in-line files msg.attach(inline_part(filename1, image_cid1)) msg.attach(inline_part(filename2, image_cid2)) # attach the attachment file msg.attach(attach_part(filename3)) # Open a connection to the mail server, log-on, send the message and disconnect try: server = smtplib.SMTP_SSL(mServer, mPort) server.set_debuglevel(0) server.login(sLogin, sPass) server.send_message(msg) server.quit() print ("Message sent Successfully") except Exception as e: print ("Error sending mail:\n\t" + str(e)) 并返回高度,要么在标签上设置顶部和底部约束并在heightForRowAt中自动设置

viewDidLoad

尝试解决这些问题,然后查看分隔符是否显示

//

我已经创建了一个演示检查Here,还请确保您是否在模拟器中运行以随着分隔符以小比例尺消失而缩放或增加比例

//

enter image description here

答案 1 :(得分:1)

可能的原因是您正在一个非常大的屏幕模拟器中运行并且将其缩小为较小的尺寸,模拟器有时会将诸如分隔线之类的细视图压缩为空,只是放大了模拟器窗口较大或使用真实设备,您会看到它。

检查了您的项目,即使它存在约束错误,它也可以正常工作,并且分隔线可以正常显示。